fork of http://www.codeproject.com/Articles/7933/Smart-Thread-Pool