mirror of
https://github.com/lloeki/normandy.git
synced 2025-12-06 01:54:40 +01:00
15 lines
216 B
Ruby
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
|