我根据这些文件编写了无锁双向链表:
“基于引用计数的高效可靠的无锁内存回收”,Anders Gidenstam,成员,IEEE,Marina Papatriantafilou,H˚akan Sundell和Philippas Tsigas
“无锁双端队列和双链表”,Philippas Tsigas,HåkanSundell
对于这个问题,我们可以搁置第一篇论文。
在本文中,他们使用一种聪明的方式在单词中存储删除标记和指针。 (更多信息在这里 )
本文中此部分的伪代码:union Link
: word
(p,d): {pointer to Node, boolean}
structure Node
value: pointer to word
prev: union Link
next: union Link
而我的上述伪代码的代码:template< typename NodeT >
struct LockFreeLink
{
public:
typedef NodeT NodeType;
private:
protected:
std::atomic< NodeT* > mPointer;
public:
bcLockFreeLink()
{
std::atomic_init(&mPointer, nullptr);
}
~bcLockFreeLink() {}
inline NodeType* getNo