CppLogging  1.0.4.0
C++ Logging Library
Classes | Public Member Functions | List of all members
CppLogging::AsyncWaitFreeQueue< T > Class Template Reference

Asynchronous wait-free logging ring queue. More...

#include <async_wait_free_queue.h>

Public Member Functions

 AsyncWaitFreeQueue (size_t capacity)
 Default class constructor. More...
 
 AsyncWaitFreeQueue (const AsyncWaitFreeQueue &)=delete
 
 AsyncWaitFreeQueue (AsyncWaitFreeQueue &&)=delete
 
 ~AsyncWaitFreeQueue ()
 
AsyncWaitFreeQueueoperator= (const AsyncWaitFreeQueue &)=delete
 
AsyncWaitFreeQueueoperator= (AsyncWaitFreeQueue &&)=delete
 
 operator bool () const noexcept
 Check if the queue is not empty. More...
 
bool empty () const noexcept
 Is ring queue empty? More...
 
size_t capacity () const noexcept
 Get ring queue capacity. More...
 
size_t size () const noexcept
 Get ring queue size. More...
 
bool Enqueue (Record &record)
 Enqueue and swap the logging record into the ring queue (multiple producers threads method) More...
 
bool Dequeue (Record &record)
 Dequeue and swap the logging record from the ring queue (multiple consumers threads method) More...
 

Detailed Description

template<typename T>
class CppLogging::AsyncWaitFreeQueue< T >

Asynchronous wait-free logging ring queue.

Multiple producers / multiple consumers wait-free ring queue use only atomic operations to provide thread-safe enqueue and dequeue operations. Ring queue size is limited to the capacity provided in the constructor.

FIFO order is guaranteed!

Thread-safe.

C++ implementation of Dmitry Vyukov's non-intrusive lock free unbound MPSC queue http://www.1024cores.net/home/lock-free-algorithms/queues/non-intrusive-mpsc-node-based-queue

Definition at line 35 of file async_wait_free_queue.h.

Constructor & Destructor Documentation

◆ AsyncWaitFreeQueue() [1/3]

template<typename T >
CppLogging::AsyncWaitFreeQueue< T >::AsyncWaitFreeQueue ( size_t  capacity)
inlineexplicit

Default class constructor.

Parameters
capacity- Ring queue capacity (must be a power of two)

Definition at line 17 of file async_wait_free_queue.inl.

◆ AsyncWaitFreeQueue() [2/3]

template<typename T >
CppLogging::AsyncWaitFreeQueue< T >::AsyncWaitFreeQueue ( const AsyncWaitFreeQueue< T > &  )
delete

◆ AsyncWaitFreeQueue() [3/3]

template<typename T >
CppLogging::AsyncWaitFreeQueue< T >::AsyncWaitFreeQueue ( AsyncWaitFreeQueue< T > &&  )
delete

◆ ~AsyncWaitFreeQueue()

template<typename T >
CppLogging::AsyncWaitFreeQueue< T >::~AsyncWaitFreeQueue ( )
inline

Definition at line 45 of file async_wait_free_queue.h.

Member Function Documentation

◆ capacity()

template<typename T >
size_t CppLogging::AsyncWaitFreeQueue< T >::capacity ( ) const
inlinenoexcept

Get ring queue capacity.

Definition at line 56 of file async_wait_free_queue.h.

◆ Dequeue()

template<typename T >
bool CppLogging::AsyncWaitFreeQueue< T >::Dequeue ( Record record)
inline

Dequeue and swap the logging record from the ring queue (multiple consumers threads method)

Parameters
record- Logging record to dequeue and swap
Returns
'true' if the item was successfully dequeue, 'false' if the ring queue is empty

Definition at line 87 of file async_wait_free_queue.inl.

◆ empty()

template<typename T >
bool CppLogging::AsyncWaitFreeQueue< T >::empty ( ) const
inlinenoexcept

Is ring queue empty?

Definition at line 54 of file async_wait_free_queue.h.

◆ Enqueue()

template<typename T >
bool CppLogging::AsyncWaitFreeQueue< T >::Enqueue ( Record record)
inline

Enqueue and swap the logging record into the ring queue (multiple producers threads method)

Parameters
record- Logging record to enqueue and swap
Returns
'true' if the item was successfully enqueue, 'false' if the ring queue is full

Definition at line 42 of file async_wait_free_queue.inl.

◆ operator bool()

template<typename T >
CppLogging::AsyncWaitFreeQueue< T >::operator bool ( ) const
inlineexplicitnoexcept

Check if the queue is not empty.

Definition at line 51 of file async_wait_free_queue.h.

◆ operator=() [1/2]

template<typename T >
AsyncWaitFreeQueue& CppLogging::AsyncWaitFreeQueue< T >::operator= ( AsyncWaitFreeQueue< T > &&  )
delete

◆ operator=() [2/2]

template<typename T >
AsyncWaitFreeQueue& CppLogging::AsyncWaitFreeQueue< T >::operator= ( const AsyncWaitFreeQueue< T > &  )
delete

◆ size()

template<typename T >
size_t CppLogging::AsyncWaitFreeQueue< T >::size
inlinenoexcept

Get ring queue size.

Definition at line 33 of file async_wait_free_queue.inl.


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