Thread-safe blocking queue implementation on .NET
For the reference, .NET 4 introduces the System.Collections.Concurrent.BlockingCollection<T>
type to address this. For non-blocking queue, you can use System.Collections.Concurrent.ConcurrentQueue<T>
. Note that ConcurrentQueue<T>
would likely be used as the underlying datastore for the BlockingCollection<T>
for the OP's usage.
How about this one Creating a blocking Queue in .NET?
If you need it for .NET 1.1 (I wasn't sure from the question), just drop the generics and replace T
with object
.
Queue.Synchronized http://msdn.microsoft.com/en-us/library/system.collections.queue.synchronized(VS.71).aspx
Is a starting point anyways, I've never used a Blocking Queue. Sorry for the not so relevant post.