refactored from threadpool to task

I am a PhD student in the CS department at the University of Illinois. I'm currently doing research on refactoring tools for parallel programming. I developed a tool that migrates Thread constructs to Task and convert some Task patterns to higher-level Parallel class.

The tool found some opportunities in your application and performed some changes. The program behavior does not change at all. If you are not interested in the Pull Request, please let me know why.