26#ifndef MYSQL_HARNESS_MPSC_UNBOUND_QUEUE_INCLUDED
27#define MYSQL_HARNESS_MPSC_UNBOUND_QUEUE_INCLUDED
78 node->
next.store(
nullptr, std::memory_order_relaxed);
80 Node *prev_head =
head_.exchange(node, std::memory_order_acq_rel);
81 prev_head->
next.store(node, std::memory_order_release);
96 node->
data = std::move(item);
97 node->
next.store(
nullptr, std::memory_order_relaxed);
99 Node *prev_head =
head_.exchange(node, std::memory_order_acq_rel);
100 prev_head->
next.store(node, std::memory_order_release);
115 Node *tail =
tail_.load(std::memory_order_relaxed);
116 Node *next = tail->
next.load(std::memory_order_acquire);
118 if (next ==
nullptr) {
122 item = std::move(next->
data);
124 tail_.store(next, std::memory_order_relaxed);
134 std::atomic<Node *>
next{
nullptr};
a unbounded multi-producer single-consumer queue.
Definition: mpsc_queue.h:43
~MPSCQueueDV()
Definition: mpsc_queue.h:50
MPSCQueueDV()
Definition: mpsc_queue.h:47
MPSCQueueDV(MPSCQueueDV &&)=default
MPSCQueueDV(const MPSCQueueDV &)=delete
bool enqueue(const T &item)
enqueue an element.
Definition: mpsc_queue.h:75
MPSCQueueDV & operator=(MPSCQueueDV &&)=default
T value_type
Definition: mpsc_queue.h:45
bool dequeue(T &item)
try to dequeue element.
Definition: mpsc_queue.h:114
MPSCQueueDV & operator=(const MPSCQueueDV &)=delete
bool enqueue(T &&item)
enqueue an element.
Definition: mpsc_queue.h:94
std::atomic< Node * > tail_
Definition: mpsc_queue.h:138
std::atomic< Node * > head_
Definition: mpsc_queue.h:137
provide waiting pop and push operator to thread-safe queues.
Definition: waiting_queue_adaptor.h:39
bool load(THD *, const dd::String_type &fname, dd::String_type *buf)
Read an sdi file from disk and store in a buffer.
Definition: sdi_file.cc:308
Definition: gcs_xcom_synode.h:64
Definition: mpsc_queue.h:132
T data
Definition: mpsc_queue.h:133
std::atomic< Node * > next
Definition: mpsc_queue.h:134
int front
Definition: xcom_base.cc:4057