Threadz not finishing
require 'rubygems' | |
require 'threadz' | |
def dostuff(i) | |
sleep 1 | |
raise "Exception" if i == 4 | |
end | |
tp = Threadz::ThreadPool.new | |
batch = tp.new_batch | |
[1,2,3,4,5].each do |i| | |
batch << lambda { dostuff(i) } | |
end | |
puts "Wait" | |
batch.wait_until_done | |
puts "Comes here" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment