I have the following piece of threading code:
Thread.new(i) do |j|
#$SAFE = 4
b = 0
loop do
b += 1
raise ‘Test’ if j == 3 and b == 100
sleep(0)
end
end
This behaves as expected - if Thread.abort_on_exception is true, the program
throws an exception and dies, otherwise just this thread dies, and no
exception I can rescue. So far, so good.
If, however, I uncomment the line with $SAFE = 4, it behaves as if
Thread.abort_on_exception is false, and so I can’t catch any exception when a
thread dies, and so I can’t find out what happened, which I need to! What can
I do about this?
Tim Bates