mirror of
https://github.com/lloeki/normandy.git
synced 2025-12-06 10:04:39 +01:00
15 lines
281 B
Ruby
15 lines
281 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 { |i, co|
|
|
1.upto(5) do |j|
|
|
co << format("hi from %d.%d", i, j)
|
|
end
|
|
}, i, c)
|
|
end
|
|
|
|
25.times { puts c.recv }
|