How can I force TPL to use a fixed number of threads? I know MaxDegreeOfParallelism can be used to set the upper limit, but I want the upper limit to equal the lower limit. Is this possible? How?
Because I know someone will ask =) yes, I’m sure I want to do this and yes its optimal for my scneario. =)
EDIT
The solution requires a custom Partitioner as well as the custom TaskScheduler http://social.msdn.microsoft.com/Forums/en-US/parallelextensions/thread/002ff888-6e13-4d7e-a234-1632e8a1f551
You could create your own TaskScheduler if you really needed to, but using TaskCreationOptions.LongRunning is probably the best approach.
How to: Create a Task Scheduler That Limits the Degree of Concurrency