Skip to content

Instantly share code, notes, and snippets.

@mperham
Created March 11, 2012 03:02
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 mperham/2014773 to your computer and use it in GitHub Desktop.
Save mperham/2014773 to your computer and use it in GitHub Desktop.
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