An example implementation of the self-pipe trick in Ruby, by Paul Annesley (found here: http://pastebin.com/1SZprwZm)
Further reading:
- D.J. Berstein - The self-pipe trick - http://cr.yp.to/docs/selfpipe.html
- Alex Pennace - Safe UNIX Signal Handling Tips - http://osiris.978.org/~alex/safesignalhandling.html
- Ryan Tomayko - I like Unicorn because it's Unix - http://tomayko.com/writings/unicorn-is-unix
- Unicorn Sourcecode - http://bogomips.org/unicorn.git/tree/lib/unicorn/http_server.rb
man 2 select