Created
August 19, 2014 23:15
-
-
Save joevandyk/4bdbf5a7a713575a761f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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