Thread.abort_on_exception = true : abort_on_exception « Threads « Ruby






Thread.abort_on_exception = true



Thread.abort_on_exception = true 
threads = [] 
4.times do |number| 
    threads << Thread.new(number) do |i| 
        raise "Boom!" if i == 2 
        print "#{i}\n" 
    end 
end 
threads.each {|t| t.join } 

 








Related examples in the same category

1.threadInstance.abort_on_exception = true