Skip to content

Instantly share code, notes, and snippets.

@octplane
Created November 26, 2010 12:28
Show Gist options
  • Save octplane/716647 to your computer and use it in GitHub Desktop.
Save octplane/716647 to your computer and use it in GitHub Desktop.
caller_for_all_threads fails to work in a multithread program using sleep conditions
#!/usr/bin/env ruby
Thread.new do
sleep(15)
puts "dumping stacks"
puts caller_for_all_threads.inspect
puts "done."
end
while true do
sleep(10)
puts "Sleeping thread"
end
# This should dump the stacks after 15s of runtime.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment