阻止收集不是空的 [英] Blocking collection not empty

查看:63
本文介绍了阻止收集不是空的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的一个项目中,我们使用的是生产者和消费者模式。

In one of our projects we are using producer and consumer pattern.

我们正在向阻止集合添加项目的一个线程。

One thread we are adding items to blocking collection.

使用for循环我们正在开放10个线程来处理阻塞收集项目。

Using for loop we are opening for 10 threads processing blocking collection items.

它的工作时间有些但有些时候阻塞集合中的项目没有正确删除它会去无限循环。

Its works for some times but some times items in blockingcollection not removing properly and it goes to infinite loop.

对此有何帮助?

 

推荐答案

嗨  raghavmadamshitti,

Hi raghavmadamshitti,

感谢您在此发帖。

这是一个类似的帖子供您参考。

Here is a similar thread for your reference.

https://stackoverflow。 COM /问题/ 41271071 /如何 - 队 - 上 - 代表将要执行的功能于系列中最背景与-C / 41271450#412 71450

希望它会有所帮助。

最好的问候,

Wendy


这篇关于阻止收集不是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆