MySQL 8.0.29
Source Code Documentation
mysql_harness::MPSCQueueDV< T > Class Template Reference

a unbounded multi-producer single-consumer queue. More...

#include <mpsc_queue.h>

Classes

struct  Node
 

Public Types

using value_type = T
 

Public Member Functions

 MPSCQueueDV ()
 
 ~MPSCQueueDV ()
 
 MPSCQueueDV (const MPSCQueueDV &)=delete
 
MPSCQueueDVoperator= (const MPSCQueueDV &)=delete
 
 MPSCQueueDV (MPSCQueueDV &&)=default
 
MPSCQueueDVoperator= (MPSCQueueDV &&)=default
 
bool enqueue (const T &item)
 enqueue an element. More...
 
bool enqueue (T &&item)
 enqueue an element. More...
 
bool dequeue (T &item)
 try to dequeue element. More...
 

Private Attributes

std::atomic< Node * > head_
 
std::atomic< Node * > tail_
 

Detailed Description

template<typename T>
class mysql_harness::MPSCQueueDV< T >

a unbounded multi-producer single-consumer queue.

multiple threads can write at the same time into the queue, only one can read

http://www.1024cores.net/home/lock-free-algorithms/queues/non-intrusive-mpsc-node-based-queue

Member Typedef Documentation

◆ value_type

template<typename T >
using mysql_harness::MPSCQueueDV< T >::value_type = T

Constructor & Destructor Documentation

◆ MPSCQueueDV() [1/3]

template<typename T >
mysql_harness::MPSCQueueDV< T >::MPSCQueueDV ( )
inline

◆ ~MPSCQueueDV()

template<typename T >
mysql_harness::MPSCQueueDV< T >::~MPSCQueueDV ( )
inline

◆ MPSCQueueDV() [2/3]

template<typename T >
mysql_harness::MPSCQueueDV< T >::MPSCQueueDV ( const MPSCQueueDV< T > &  )
delete

◆ MPSCQueueDV() [3/3]

template<typename T >
mysql_harness::MPSCQueueDV< T >::MPSCQueueDV ( MPSCQueueDV< T > &&  )
default

Member Function Documentation

◆ dequeue()

template<typename T >
bool mysql_harness::MPSCQueueDV< T >::dequeue ( T &  item)
inline

try to dequeue element.

Parameters
itemlocation of dequeued item if dequeue() was successful
Returns
if item was written
Return values
truefirst item removed from the queue and assigned to item
falsequeue is empty

◆ enqueue() [1/2]

template<typename T >
bool mysql_harness::MPSCQueueDV< T >::enqueue ( const T &  item)
inline

enqueue an element.

Parameters
itemitem to enqueue
Returns
if item was enqueued
Return values
trueitem got assigned to queue

◆ enqueue() [2/2]

template<typename T >
bool mysql_harness::MPSCQueueDV< T >::enqueue ( T &&  item)
inline

enqueue an element.

Parameters
itemitem to enqueue
Returns
if item was enqueued
Return values
trueitem got assigned to queue

◆ operator=() [1/2]

template<typename T >
MPSCQueueDV & mysql_harness::MPSCQueueDV< T >::operator= ( const MPSCQueueDV< T > &  )
delete

◆ operator=() [2/2]

template<typename T >
MPSCQueueDV & mysql_harness::MPSCQueueDV< T >::operator= ( MPSCQueueDV< T > &&  )
default

Member Data Documentation

◆ head_

template<typename T >
std::atomic<Node *> mysql_harness::MPSCQueueDV< T >::head_
private

◆ tail_

template<typename T >
std::atomic<Node *> mysql_harness::MPSCQueueDV< T >::tail_
private

The documentation for this class was generated from the following file: