Created
March 11, 2012 03:02
-
-
Save mperham/2014773 to your computer and use it in GitHub Desktop.
Bug in ruby 1.9.3 threading?
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
trap 'INT' do | |
puts 'Got Ctrl-C' | |
puts Thread.current | |
puts Thread.main | |
puts Thread.main.status | |
# BUG BUG BUG | |
# This does not result in the main thread waking up from | |
# the Thread.stop call below. | |
Thread.main.run | |
puts Thread.main.status | |
end | |
# spin off our worker threads | |
t2 = Thread.new do | |
while true | |
sleep 1 | |
puts 'hello' | |
end | |
end | |
puts "PID: #{Process.pid} stopping main thread, waiting for Ctrl-C" | |
Thread.stop | |
puts 'all done, exiting!' | |
t2.stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://bugs.ruby-lang.org/issues/6128