Skip to content

Instantly share code, notes, and snippets.

@joevandyk
Created August 19, 2014 23:15
def foo
t = Thread.new do
begin
sleep 1
puts "finished thread"
rescue
puts "exception raised"
ensure
puts "ensure called"
end
end
end
thread = foo
sleep 0.1
puts "killing thread"
foo.kill
sleep 3
killing thread
ensure called
finished thread
ensure called
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment