是ConcurrentQueue线程安全的吗 [英] is ConcurrentQueue Thread safe

查看:88
本文介绍了是ConcurrentQueue线程安全的吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道使用ConcurrentQueue< T>是否完全100%安全没有锁?我目前正在使用带有Queue< T>的Consumer-Producer设计模式.在读取或写入时将其锁定.我正在运行一个高频交易应用程序,所有的锁定都在某种程度上降低了我的应用程序的性能.

是ConcurrentQueue效率更高,线程安全性100%吗?

预先感谢,
DA

Wanted to know if it''s totally 100% safe to use a ConcurrentQueue<T> without a lock? I''m currently using Consumer-Producer design pattern with a Queue<T> that I lock when reading or writing to it. I''m running a high-frequency trading application and all of the locking is degrading the performance of my app to some extent.

Is the ConcurrentQueue more efficient and 100% threadSafe?

Thanks in advance,
DA

推荐答案

发现这个代表线程安全的先进先出(FIFO)集合并不难."
http://msdn.microsoft.com/en-us/library/dd267265.aspx [ ^ ]
It wasn''t difficult to spot this "Represents a thread-safe first in-first out (FIFO) collection."
http://msdn.microsoft.com/en-us/library/dd267265.aspx[^]


这篇关于是ConcurrentQueue线程安全的吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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