C# 4.0’s new BlockingCollection doesn’t answer a simple requirement we need:
* Concurrent-queue for tasks items.
* Consumers – limited N threads at a time – from the threadpool (threads which are not dedicated to this queue and are not blocked if there are no items in the queue).
especially useful for resources usage we need to limit with only one (N = 1) thread at a time and the queue can be empty from time to time.
SmartThreadPool have a nice implementation for this purpose, using threads-group of the size of 1.
I was looking for a nice solution with the new C# 4.0 parallel lib, leveraging the .Net internal threadpool.
I can think of a few solutions for this, but I wonder if there’s something elegant which I’m missing.
What do you think?
Regards,
Shlomi
if anyone interests in a proposed solution, please see the following thread under msdn forums:
msdn parallel computing forums question.
It’s question I asked relevant to the above and Stephen Toub gave me a satisfying answer.
Shlomi