Flow
Documentation for the Flow C++ Library
|
A thread-safe concurrent queue with flexible push and pop operations. More...
#include <flow_concurrent_flex_queue.h>
Classes | |
struct | Node |
Public Member Functions | |
ConcurrentFlexQueue () | |
Constructs an empty queue. | |
ConcurrentFlexQueue (const ConcurrentFlexQueue &)=delete | |
ConcurrentFlexQueue (ConcurrentFlexQueue &&)=delete | |
ConcurrentFlexQueue & | operator= (const ConcurrentFlexQueue &)=delete |
ConcurrentFlexQueue & | operator= (ConcurrentFlexQueue &&)=delete |
bool | empty () const |
Checks if the queue is empty. | |
void | push (const T &value) |
Pushes a new element into the queue. | |
void | push (T &&value) |
Pushes a new element into the queue. | |
template<typename... Args> | |
void | emplace (Args &&... args) |
Constructs a new element in place at the end of the queue. | |
std::optional< T > | tryFront () const |
Attempts to retrieve the first element without removing it. | |
std::optional< T > | tryPop () |
Attempts to pop and return the first element. | |
T | waitPop () |
Waits until the queue is not empty, then pops and returns the first element. |
Private Attributes | |
std::unique_ptr< Node > | head_ |
Node * | tail_ |
std::mutex | headMux_ |
std::mutex | tailMux_ |
std::condition_variable | blocked_ |
A thread-safe concurrent queue with flexible push and pop operations.
Definition at line 11 of file flow_concurrent_flex_queue.h.
|
inline |
Constructs an empty queue.
Definition at line 25 of file flow_concurrent_flex_queue.h.
Referenced by ConcurrentFlexQueue(), ConcurrentFlexQueue(), operator=(), and operator=().
|
delete |
References ConcurrentFlexQueue().
|
delete |
References ConcurrentFlexQueue().
|
inline |
Constructs a new element in place at the end of the queue.
args | Arguments forwarded to construct the new element. |
Definition at line 70 of file flow_concurrent_flex_queue.h.
|
inline |
Checks if the queue is empty.
Definition at line 36 of file flow_concurrent_flex_queue.h.
|
delete |
References ConcurrentFlexQueue().
|
delete |
References ConcurrentFlexQueue().
|
inline |
Pushes a new element into the queue.
value | The element to add. |
Definition at line 43 of file flow_concurrent_flex_queue.h.
|
inline |
Pushes a new element into the queue.
value | The element to add. |
Definition at line 56 of file flow_concurrent_flex_queue.h.
|
inline |
Attempts to retrieve the first element without removing it.
Definition at line 83 of file flow_concurrent_flex_queue.h.
|
inline |
Attempts to pop and return the first element.
Definition at line 93 of file flow_concurrent_flex_queue.h.
|
inline |
Waits until the queue is not empty, then pops and returns the first element.
Definition at line 106 of file flow_concurrent_flex_queue.h.
|
private |
|
private |
Definition at line 17 of file flow_concurrent_flex_queue.h.
Referenced by ConcurrentFlexQueue(), empty(), tryFront(), tryPop(), and waitPop().
|
mutableprivate |
Definition at line 19 of file flow_concurrent_flex_queue.h.
Referenced by empty(), tryFront(), tryPop(), and waitPop().
|
private |
Definition at line 18 of file flow_concurrent_flex_queue.h.
Referenced by ConcurrentFlexQueue(), emplace(), empty(), push(), push(), tryFront(), tryPop(), and waitPop().
|
mutableprivate |