Skip to content

Instantly share code, notes, and snippets.

@jjb
Created September 15, 2012 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjb/3726473 to your computer and use it in GitHub Desktop.
Save jjb/3726473 to your computer and use it in GitHub Desktop.
t = Thread.start{
begin
puts "starting executing code!"
sleep 1
puts "done executing code!" # we don't expect to reach here
rescue Exception
puts "rescuing!" # we don't expect to reach here
ensure
puts "ensuring!" # will we reach here????? (yes)
end
}
t.kill
t.join
puts "done!"
➔ ruby ../thing.rb
ensuring!
done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment