14 memset(_pad0, 0,
sizeof(cache_line_pad));
15 memset(_pad1, 0,
sizeof(cache_line_pad));
16 memset(_pad2, 0,
sizeof(cache_line_pad));
19 Node* front = _head.load(std::memory_order_relaxed);
20 front->next.store(
nullptr, std::memory_order_relaxed);
28 while (Dequeue(item)) {}
31 Node* front = _head.load(std::memory_order_relaxed);
39 return Enqueue(std::forward<T>(temp));
46 Node* node =
new Node;
51 node->value = std::move(item);
52 node->next.store(
nullptr, std::memory_order_relaxed);
55 Node* prev_head = _head.exchange(node, std::memory_order_acq_rel);
56 prev_head->next.store(node, std::memory_order_release);
64 Node* tail = _tail.load(std::memory_order_relaxed);
65 Node* next = tail->next.load(std::memory_order_acquire);
72 item = std::move(next->value);
75 _tail.store(next, std::memory_order_release);
bool Enqueue(const T &item)
Enqueue an item into the linked queue (multiple producers threads method)
bool Dequeue(T &item)
Dequeue an item from the linked queue (single consumer thread method)
C++ Common project definitions.