Exmple of how to implement thread pool.