autotier
Automatic Tiering Fuse Filesystem
Public Member Functions | Private Attributes | List of all members
ConcurrentQueue< T > Class Template Reference

Single-consumer multiple-producer concurrent FIFO queue. More...

#include <concurrentQueue.hpp>

Public Member Functions

 ConcurrentQueue ()
 Construct a new Concurrent Queue object. More...
 
 ~ConcurrentQueue ()=default
 Destroy the Concurrent Queue object. More...
 
bool empty (void) const
 Check if queue is empty. Call this first before trying to pop(). More...
 
void push (const T &val)
 Insert into queue with std::queue<T>::push(). More...
 
template<typename... Args>
void emplace (Args &&...args)
 Emplace into queue with std::queue<T>::emplace(). More...
 
pop (void)
 Pop value from queue. Check empty() first! More...
 

Private Attributes

std::mutex mt_
 Mutex for synchronization.
 
std::queue< T > queue_
 Underlying queue to store objects in.
 

Detailed Description

template<class T>
class ConcurrentQueue< T >

Single-consumer multiple-producer concurrent FIFO queue.

Template Parameters
TType to store.

Constructor & Destructor Documentation

◆ ConcurrentQueue()

template<class T >
ConcurrentQueue< T >::ConcurrentQueue ( )
inline

Construct a new Concurrent Queue object.

◆ ~ConcurrentQueue()

template<class T >
ConcurrentQueue< T >::~ConcurrentQueue ( )
default

Destroy the Concurrent Queue object.

Member Function Documentation

◆ emplace()

template<class T >
template<typename... Args>
void ConcurrentQueue< T >::emplace ( Args &&...  args)
inline

Emplace into queue with std::queue<T>::emplace().

Template Parameters
Argsargs to expand into constructor of T
Parameters
argsargs to expand into constructor of T

◆ empty()

template<class T >
bool ConcurrentQueue< T >::empty ( void  ) const
inline

Check if queue is empty. Call this first before trying to pop().

Returns
true Queue is empty, do not pop().
false Queue is not empty, safe to pop().

◆ pop()

template<class T >
T ConcurrentQueue< T >::pop ( void  )
inline

Pop value from queue. Check empty() first!

Returns
T Object returned from queue

◆ push()

template<class T >
void ConcurrentQueue< T >::push ( const T &  val)
inline

Insert into queue with std::queue<T>::push().

Parameters
valValue to insert.

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