需要具有 .NET 4.0 新功能的单一生产者/单一消费者模式示例
.NET 在 System.Collection.Concurrent 和一些同步类下添加了新的并发功能。使用这些功能的单一生产者-单一消费者模式是否有任何好的示例? (实际上,如果它还没有将其实现为共享缓冲区,我将为其添加一个循环缓冲区模式)
.NET for added new concurrency features under System.Collection.Concurrent and some synchronization classes. Is there any good sample for single producer - single consumer pattern using these feature ? (Actually I will add a circular buffer pattern to it if it already doesn't implement it as the shared buffer)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
新类型
BlockingCollection
(请参阅 MSDN) 实现生产者/消费者模式。它可以被多个生产者/消费者同时访问,但它也可以与单个生产者和消费者一起完美地工作。The new type
BlockingCollection<T>
(see MSDN) implements a producer/consumer pattern. It can be accessed by multiple producers/consumers concurrently, but it will work perfectly fine with a single producer and consumer too.