Ruby/Threads/abort on exception
Материал из Wiki.crossplatform.ru
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 }
threadInstance.abort_on_exception = true
t1 = Thread.new do puts "Hello" sleep 2 raise "some exception" puts "Goodbye" end t1.abort_on_exception = true t2 = Thread.new { sleep 100 } sleep 2 puts "The End"