mirror of
https://github.com/lloeki/normandy.git
synced 2025-12-06 01:54:40 +01:00
15 lines
282 B
Ruby
15 lines
282 B
Ruby
# http://stackoverflow.com/questions/15715605/multiple-goroutines-listening-on-one-channel
|
|
|
|
require 'channel'
|
|
|
|
c = Channel.new
|
|
|
|
1.upto(5) do |i|
|
|
go(lambda do |i, co|
|
|
1.upto(5) do |j|
|
|
co << format('hi from %d.%d', i, j)
|
|
end
|
|
end, i, c)
|
|
end
|
|
|
|
25.times { puts c.recv }
|