normandy/examples/channel_synchronization.rb
2015-12-15 13:50:47 +01:00

15 lines
216 B
Ruby

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