Project

General

Profile

Bug #12298 » 12998.rb

Reduced test case - drbrain (Eric Hodel), 04/19/2016 06:46 PM

 
DELAY = 2

Thread.abort_on_exception = true

def run
loop { work }
rescue Exception
puts "#{Time.now} Exception"
ensure
puts "#{Time.now} stopping agent"
end


def work
puts "#{Time.now} start work"
sleep
puts "finished work"
rescue
puts "#{Time.now} Error"
ensure
puts "#{Time.now} start sleep"
sleep(DELAY)
puts "#{Time.now} finished sleep"
end

t = Thread.new{ run }

at_exit do
puts "#{Time.now} killing thread"
Thread.kill(t)
puts "#{Time.now} killed thread"
end

sleep 2
exit
(3-3/3)