Skip to content

Instantly share code, notes, and snippets.

@yorickpeterse
Last active August 29, 2015 14:07
Show Gist options
  • Save yorickpeterse/bcf46210c288c6fd045e to your computer and use it in GitHub Desktop.
Save yorickpeterse/bcf46210c288c6fd045e to your computer and use it in GitHub Desktop.
input = (0 .. 10).to_enum
enums = [input]
threads = []
10.times do |i|
enums[i].each do |value|
threads << Thread.new { output << (value + 1) }
end
end
threads.each { |t| t.join }
input = (0 .. 10).to_enum
enums = [input]
threads = []
10.times do |i|
threads << Thread.new do
enums[i].each do |value|
output << (value + 1)
end
end
end
threads.each { |t| t.join }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment