Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Questions about the ThreadPool

I have a few questions about the ThreadPool. Primarily, If I wanted to limit the number of threads in execution asynchronously, what would I change? Secondly, in set maximum and set minimum number of threads, what are the completion port threads?

like image 338
Joey Gfd Avatar asked Aug 24 '26 02:08

Joey Gfd


1 Answers

Don't mess with the ThreadPool (i.e. limiting threads) - it isn't yours to mess with, and core parts of the system will want it. You risk starvation and deadlock.

Either use a custom thread-pool implementation, or use the inbuilt options in the TPL to run an operation on a constrained number of threads.

like image 60
Marc Gravell Avatar answered Aug 25 '26 16:08

Marc Gravell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!