ConcurrentDictionary 和可见性
我读到 ConcurrentDictionary 仅在写入时锁定,因此读取是无锁的。
http://blogs.msdn.com/b/pfxteam /archive/2010/01/08/9945809.aspx 对字典的读取是以无锁方式执行的
但是可见性怎么样,当读取是无锁时,它们如何确保这一点?
I have read that ConcurrentDictionary only locks when writing, so the reads are lock free.
http://blogs.msdn.com/b/pfxteam/archive/2010/01/08/9945809.aspx
reads on the dictionary are performed in a lock-free manner
But what about visibility, how do they ensure this when the reads are lock free?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MemoryBarrier 的使用可确保对象为其他线程“发布”。这不需要锁。
The use of the MemoryBarrier ensures that the objects are 'published' for other threads. This does not require a lock.