Skip to content

Instantly share code, notes, and snippets.

Created January 21, 2013 17:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4587808 to your computer and use it in GitHub Desktop.
Save anonymous/4587808 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
Thread.new do
loop do
puts "background thread in #{$$} woke"
sleep(1)
end
end
sleep(2)
puts "#{$$} daemonizing"
Process.daemon(true, true)
puts "#{$$} exiting with #{Thread.list.size} Ruby threads"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment