threadInstance.abort_on_exception = true : abort_on_exception « Threads « Ruby
- Ruby
- Threads
- abort_on_exception
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"
Related examples in the same category