Languages
[Edit]
EN

C#/.NET - thread pool

13 points
Created by:
Elleanor-Williamson
380

Sometimes it is necessary to create a lot of threads in short time. When task is small, the time of thread creating and destroying could take more time than task execution. To solve this problem ThreadPool class is useful. It manages of thread pool and brings threads ready to execute tasks. After task executed puts thread back to pool for next tasks to save resources speeding up all.

Quick solution:

 

Practical example

Edit

Output:

Note: Code has been run with 4 cores CPU.

 

See also

Edit
  1. C#/.NET - max and min number of threads in thread pool

References

Edit
  1. ThreadPool Class - Microsoft Docs
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

C# - Thread Class

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join