当多个线程以parlally运行时,将跳过队列项 [英] Queue Items are skipped when multiple threads are running in parlally

查看:44
本文介绍了当多个线程以parlally运行时,将跳过队列项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



当parallay中运行多个线程时,会跳过一些队列(点网队列(集合))项。请解决此问题..

解决方案

如果您需要线程安全,请使用 ConcurrentQueue< T> - ConcurrentQueue [ ^ ]。这个队列的优点是当多个线程读取或写入数据时,队列本身会处理锁定。



您可以始终在正常队列中实现锁定。

Dear Friends,

Some Queue (Dot net Queue (Collections))Items are skipped when multiple threads are running in parallay .Please Address this problem..

解决方案

If you need thread safety, use ConcurrentQueue<T> - ConcurrentQueue[^]. The advantage with this queue is when multiple threads read or write data, locking is taken care of by the queue itself.

You could always implement locking in a normal queue.


这篇关于当多个线程以parlally运行时,将跳过队列项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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