Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bug in ruby 1.9.3 threading?
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
@mperham
Copy link
Author

mperham commented Mar 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment