20 Dequeue([](
const T&){});
27 return Enqueue(std::forward<T>(temp));
34 Node* node =
new Node;
39 node->value = std::move(item);
42 Node* prev_head = _head.load(std::memory_order_relaxed);
45 node->next = prev_head;
46 }
while (!_head.compare_exchange_weak(prev_head, node, std::memory_order_release));
54 assert((handler) &&
"Batch handler must be valid!");
56 Node* last = _head.exchange(
nullptr, std::memory_order_acq_rel);
57 Node* first =
nullptr;
70 }
while (last !=
nullptr);
80 }
while (first !=
nullptr);
bool Dequeue(const std::function< void(const T &)> &handler=[](const int &){})
Dequeue all items from the linked queue (single consumer thread method)
bool Enqueue(const T &item)
Enqueue an item into the linked batcher (multiple producers threads method)
C++ Common project definitions.