Create Your Own Thread Pool
Consisting of only a couple of classes, the preceding thread pool is a generic thread pool similar to the built-in System.Threading.ThreadPool class, designed for general use. The above thread pool differs from the built-in class in that it will very quickly ramp up the number of threads to accommodate the workload and slowly close threads when idle. In addition, you have full control over what is processed by the thread pool and you can create multiple thread pools. By incorporating a thread pool into your application, you will allow your application to take better advantage of multiple processing cores. However, remember not to create an excessive number of thread pools, because each instance will have the overhead of a single management thread plus the minimum number of worker threads.
Download the Code
You can download the code that accompanies the article here.
About the Author
Page 3 of 3