Click here to Skip to main content
15,884,472 members
Articles / General Programming / Threads
Alternative
Tip/Trick

Simple Blocking Queue for Thread Communication and Inter-thread Invocation

Rate me:
Please Sign up or sign in to vote.
4.67/5 (5 votes)
24 Jan 2011CPOL 8.5K   6  
In .NET 4.0, you can use:New Concurrent.BlockingCollection(New Queue)This even has an option on the constructor to let you specify a maximum queue depth. If it reaches this depth, a call to Add will block until the consumer thread takes something out of the queue.
In .NET 4.0, you can use:

New Concurrent.BlockingCollection(New Queue)

This even has an option on the constructor to let you specify a maximum queue depth. If it reaches this depth, a call to Add will block until the consumer thread takes something out of the queue.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --