tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
lockfreelist.h
Go to the documentation of this file.
1 #ifndef LLIST_H_
2 #define LLIST_H_
3 
4 #include <cstdint>
5 
6 // boolean CAS_PTR for ease of coding.
7 #define CAS_PTR_BOOL(addr, old, new) (old == CAS_PTR(addr, old, new))
8 #define MEM_BLOCK_SIZE 1000000 //16MB (node_t = 16b)
9 #define MEM_BLOCK_CNT 500 // 8GB of mem max
10 
12 {
13 public:
14  struct Node
15  {
16  uint32_t key;
18  };
19 
20  LockfreeList();
21  ~LockfreeList();
22 
23  bool Find(uint32_t key);
24  bool Insert(uint32_t key);
25  bool Delete(uint32_t key);
26 
27  int Size();
28 
29  void Print();
30 
31 private:
32  Node* LocatePred(uint32_t key, Node** left_node);
33 
34 private:
37 
38  // Memory pool
39  Node** mem; // Memory blocks
40  uint32_t memptr; // Current cell
41 };
42 
43 #endif
LockfreeList()
Definition: lockfreelist.cc:94
Node ** mem
Definition: lockfreelist.h:39
Node * m_head
Definition: lockfreelist.h:35
Node * next
Definition: lockfreelist.h:17
~LockfreeList()
Definition: lockfreelist.cc:113
Node * m_tail
Definition: lockfreelist.h:36
void Print()
Definition: lockfreelist.cc:217
bool Delete(uint32_t key)
Definition: lockfreelist.cc:190
Definition: lockfreelist.h:11
bool Insert(uint32_t key)
Definition: lockfreelist.cc:142
int Size()
Definition: lockfreelist.cc:128
Definition: lockfreelist.h:14
uint32_t key
Definition: lockfreelist.h:16
uint32_t memptr
Definition: lockfreelist.h:40
Node * LocatePred(uint32_t key, Node **left_node)
Definition: lockfreelist.cc:30
bool Find(uint32_t key)
Definition: lockfreelist.cc:87