上图是我的数据结构。我定义了一个线程安全的静态变量(作用:消息队列)用来存储消息,如下:
private static ConcurrentDictionary<string, ConcurrentQueue<SignalModel>> _dic = new ConcurrentDictionary<string, ConcurrentQueue<SignalModel>>();
既用到了ConcurrentDictionary又用到了ConcurrentQueue。用字典是因为要根据IP分组存储。
我就是不知道用了ConcurrentDictionary之后,字典的value是否还有必要使用ConcurrentQueue来定义。
是否应该将ConcurrentQueue改成List?
相关问题
- Volatile for structs and collections of structs
- ConcurrentDictionary with multiple values per key,
- Safely removing list mapping from ConcurrentDictio
- Different behaviour when collection modified betwe
- 关于 ConcurrentDictionary 遍历问题
相关文章
- 关于 ConcurrentDictionary 遍历问题
- How can I convert a ConcurrentDictionary to a Dict
- 多线程的ConcurrentDictionary,两个线程一个访问、一个清空后填充
- C# ConcurrentDictionary多线程遍历问题
- Is the list order of a ConcurrentDictionary guaran
-
Calling ToList() on ConcurrentDictionary
whi - c# ConcurrentDictionary和ConcurrentQueue怎么使用?
- 扩展方法获取“不超载的方法”错误(Extension method Gets “No overloa
参考 Concurrent collections is it safe to modify from different threads: