锁定*和放大器;线程安全的IList< T>对于.NET
有没有无锁和放大器;实现IList线程安全的数据结构?
Is there a lock-free & thread-safe data structure that implements IList?
当然由无锁我的意思是一个实现,是没有用的锁定在.NET中原语,而是采用互锁操作/原子操作来实现线程安全... 没有一个,显然是在并发数据结构...
Naturally by lock-free I mean an implementation that makes no use of locking primitives in .NET but rather uses interlocked operations / atomic operations to achieve thread safety... There isn't one, apparently under the concurrent data structures...
有没有人见过漂浮?
我见过一个Java 1实施氨基CBBS ,所谓的 LockFreeVector 但没有对.NET至今。 任何想法?
I've seen a java one implemented in amino-cbbs, called LockFreeVector but nothing for .NET so far. Any ideas?
嗯,我找不到这样一类的任何地方;所以 我给它一个镜头
Well, I couldn't find such a class anywhere; so I gave it a shot.
该人士$ C $ C我的 ConcurrentList< T>
类的可以在GitHub上。
The source code for my ConcurrentList<T>
class is available on GitHub.
这是无锁,线程安全的(我的认为的基础上,我的单元测试),和农具的IList&LT; T&GT;
。
It is lock-free, thread-safe (I think, based on my unit tests), and implements IList<T>
.
它做的没有的支持插入
, RemoveAt
/ 删除
或清除
。
It does not support Insert
, RemoveAt
/Remove
, or Clear
.
我很高兴地发现,我的实现(这是我想出了独立的)非常类似的数据结构的由一些德高望重的头脑发表的。
I was pleased to discover that my implementation (which I came up with independently) is very similar to that of a data structure published by some well-respected minds within the world of software.
有关实施本身的一个相当简短的讨论,请参阅我最近的博客帖子一下吧。
For a fairly brief discussion of the implementation itself, see my recent blog post about it.
目前,它不记录在所有的,这是一种不好的考虑如何狡猾的一些code是:(
At the moment, it is not documented at all, which is kind of bad considering how "tricky" some of the code is :(
和通过各种手段,如果你看看,发现错误或其它问题,撕裂了我一个新的。
And by all means, rip me a new one if you take a look and find bugs or other issues.
不管怎样,它可能是值得你花时间检查出来。如果你这样做,让我知道你在想什么。
Anyway, it might be worth your time to check it out. If you do, let me know what you think.