normandy/examples/channel_synchronization.rb
2015-08-03 13:50:05 +02:00

15 lines
207 B
Ruby

# https://gobyexample.com/channel-synchronization
require 'channel'
def worker(done)
puts 'working...'
sleep 1
puts 'done'
done << true
end
done = Channel.new(1)
go -> { worker(done) }
done.recv