From https://blog.engineyard.com/2011/a-modern-guide-to-threads