MySQL 9.1.0
Source Code Documentation
|
MPSC queue with FIFO semantics. More...
#include <gcs_mpsc_queue.h>
Classes | |
class | Gcs_mpsc_queue_node |
Node that holds an element (payload) of the MPSC queue. More... | |
Public Member Functions | |
Gcs_mpsc_queue () | |
Create an empty queue. More... | |
Gcs_mpsc_queue (Deleter custom_deleter) | |
~Gcs_mpsc_queue () | |
Destroy the queued nodes. More... | |
Gcs_mpsc_queue (Gcs_mpsc_queue const &)=delete | |
Gcs_mpsc_queue (Gcs_mpsc_queue &&)=delete | |
Gcs_mpsc_queue & | operator= (Gcs_mpsc_queue const &)=delete |
Gcs_mpsc_queue & | operator= (Gcs_mpsc_queue &&)=delete |
bool | push (T *payload) |
Insert payload at the end of the queue. More... | |
T * | pop () |
Attempt to retrieve the first element from the queue. More... | |
Private Attributes | |
Deleter | m_payload_deleter |
Gcs_mpsc_queue_node * | m_tail |
std::atomic< Gcs_mpsc_queue_node * > | m_head |
MPSC queue with FIFO semantics.
Implemented as a linked list of nodes. Inspired by Dmitry Vyukov's "non-intrusive MPSC node-based queue" algorithm, available on 2017-07-10 at http://www.1024cores.net/home/lock-free-algorithms/queues/non-intrusive-mpsc-node-based-queue
|
inline |
Create an empty queue.
|
inline |
|
inline |
Destroy the queued nodes.
|
delete |
|
delete |
|
delete |
|
delete |
|
inline |
Attempt to retrieve the first element from the queue.
Note that this is a non-blocking method.
T* | if the queue is not empty |
nullptr | if the queue is empty |
|
inline |
Insert payload
at the end of the queue.
payload | the element to insert |
|
private |
|
private |
|
private |