需要具有 .NET 4.0 新功能的单一生产者/单一消费者模式示例

发布于 2024-09-29 14:45:25 字数 129 浏览 9 评论 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

摇划花蜜的午后 2024-10-06 14:45:25

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文