C#

What is thread pool? How can we create thread pool in C#

A thread pool is a collection of worker threads that efficiently execute asynchronous callbacks on behalf of the application.




Thread pool is basically collection of threads which can be used for preforming task in background. Using thread pool is a good practice over creating a new thread for you task. Whenever the task of a thread from thread pool is completed, then the thread is automatically returned back into the thread queue so that it can be re-used by other asynchronous requests. .NET provides inbuilt support for thread pool. Below is a simple example which will explain how can we use the thread pool.

 

About the author

admin

Leave a Comment