.NET上的线程安全阻塞队列实现 [英] Thread-safe blocking queue implementation on .NET
问题描述
我在寻找.NET的线程安全阻塞队列的实现。
线程安全阻塞队列我的意思是:
- 线程安全访问队列,其中Dequeue方法调用阻塞一个线程,直到其他线程put(Enqueue)一些值。
I'm looking for an implementation of thread-safe blocking queue for .NET. By "thread-safe blocking queue" I mean: - thread-safe access to a queue where Dequeue method call blocks a thread untill other thread puts (Enqueue) some value.
我发现这一个:
http://www.eggheadcafe.com/articles/20060414.asp
(但它是为.NET 1.1)。
By the moment I'v found this one: http://www.eggheadcafe.com/articles/20060414.asp (But it's for .NET 1.1).
可能有人评论/批评这种实施的正确性。
或者建议另一个。
提前感谢。
Could someone comment/criticize correctness of this implementation. Or suggest some another one. Thanks in advance.
推荐答案
这个方法在.NET中创建阻止队列?
需要它为.NET 1.1(我不知道从问题),只是删除泛型,并替换 T
与对象
。
If you need it for .NET 1.1 (I wasn't sure from the question), just drop the generics and replace T
with object
.
这篇关于.NET上的线程安全阻塞队列实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!