Flow
Documentation for the Flow C++ Library
|
#include <flow_work_stealing_queue.h>
Public Member Functions | |
WorkStealingQueue ()=default | |
Constructs a concurrent FIFO queue. | |
WorkStealingQueue (const allocator_type &allocator) | |
Constructs a concurrent FIFO queue. | |
WorkStealingQueue (const WorkStealingQueue &)=delete | |
WorkStealingQueue (WorkStealingQueue &&)=delete | |
WorkStealingQueue & | operator= (const WorkStealingQueue &)=delete |
WorkStealingQueue & | operator= (WorkStealingQueue &&)=delete |
bool | empty () const |
Checks if the queue is empty. Value can be obsolete in concurrency code. | |
std::size_t | size () const |
Returns the number of elements in the queue. Value can be obsolete in concurrency code. | |
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 |
Tries to get a copy of the first element without removing it. | |
std::optional< T > | tryPop () |
Tries to pop front and return the first element. | |
T | waitPop () |
Waits until the queue is not empty, then pops and returns the first element. | |
std::optional< T > | trySteal () |
Tries to pop back and return the last element. |
Private Types | |
using | allocator_type = typename std::deque<T>::allocator_type |
Private Attributes | |
std::mutex | mux_ |
std::condition_variable | blocked_ |
std::deque< T > | queue_ |
Definition at line 11 of file flow_work_stealing_queue.h.
|
private |
Definition at line 12 of file flow_work_stealing_queue.h.
|
default |
Constructs a concurrent FIFO queue.
Referenced by operator=(), operator=(), WorkStealingQueue(), and WorkStealingQueue().
|
inlineexplicit |
Constructs a concurrent FIFO queue.
Definition at line 23 of file flow_work_stealing_queue.h.
References queue_.
|
delete |
References WorkStealingQueue().
|
delete |
References WorkStealingQueue().
|
inline |
Constructs a new element in place at the end of the queue.
Definition at line 65 of file flow_work_stealing_queue.h.
|
inline |
Checks if the queue is empty. Value can be obsolete in concurrency code.
Definition at line 34 of file flow_work_stealing_queue.h.
|
delete |
References WorkStealingQueue().
|
delete |
References WorkStealingQueue().
|
inline |
|
inline |
|
inline |
Returns the number of elements in the queue. Value can be obsolete in concurrency code.
Definition at line 40 of file flow_work_stealing_queue.h.
|
inline |
Tries to get a copy of the first element without removing it.
Definition at line 75 of file flow_work_stealing_queue.h.
|
inline |
Tries to pop front and return the first element.
Definition at line 85 of file flow_work_stealing_queue.h.
|
inline |
Tries to pop back and return the last element.
Definition at line 109 of file flow_work_stealing_queue.h.
|
inline |
Waits until the queue is not empty, then pops and returns the first element.
Definition at line 98 of file flow_work_stealing_queue.h.
|
private |
|
mutableprivate |
Definition at line 14 of file flow_work_stealing_queue.h.
Referenced by emplace(), empty(), push(), push(), size(), tryFront(), tryPop(), trySteal(), and waitPop().
|
private |
Definition at line 16 of file flow_work_stealing_queue.h.
Referenced by emplace(), empty(), push(), push(), size(), tryFront(), tryPop(), trySteal(), waitPop(), and WorkStealingQueue().