Joey Gfd
Joey Gfd

Reputation: 509

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?

Upvotes: 3

Views: 220

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1064134

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.

Upvotes: 7

Related Questions