I am looking for a good ThreadPool implementation. I understand that the .NET ThreadPool has been rewritten/improved in .NET 4, but I doubt that it suits my needs.
I have a varying number of tasks that have to be executed in parallel. I want to be able to control the maximum number of threads that work on these tasks, and if possible be able to priorize the tasks. Idle threads should be disposed and new threads should be created when necessary, up to the specified minimum/maximum.
As I understand it, I can’t control the number of threads the .NET ThreadPool uses to process my tasks (don’t want to affect the rest of the application, i.e. delegates) and I can’t assign a number of threads to only work on my tasks.
So my questions are:
- Is there a way to use the .NET ThreadPool in my scenario?
- If not, which good (preferably free) ThreadPool implementations are out there that I should look at? (.NET Framework 4 and Windows Azure compatible)
EDIT:
Added varying number of threads as a requirement.
You should take a look at that library.
http://smartthreadpool.codeplex.com/