MOTION
0.01
Framework for mixed-protocol multi-party computation
|
#include <synchronized_queue.h>
Public Member Functions | |
BasicSynchronizedQueue ()=default | |
BasicSynchronizedQueue (BasicSynchronizedQueue &&other)=default | |
bool | empty () const noexcept |
bool | IsClosed () const noexcept |
bool | IsClosedAndEmpty () const noexcept |
void | close () noexcept |
void | enqueue (const T &item) |
void | enqueue (T &&item) |
std::optional< T > | dequeue () noexcept |
std::optional< std::queue< T > > | BatchDequeue () noexcept |
Synchronized, closable queue for elements of type T.
The template is based on std::queue and provides synchronized operations such that items can be enqueued/dequeued by different threads. The queue can be customized with different synchronization primitives, e.g., std::mutex and fibers::mutex, via template parameters. Elements can be dequeued one-by-one (dequeue) or all at once (batch_dequeue). The queue can be closed which signals consumers that no further elements will be inserted. Dequeue operations return std::nullopt if the queue is closed and empty.
|
default |
|
default |
|
inlinenoexcept |
Extract all elements of the queue.
|
inlinenoexcept |
Close the queue.
|
inlinenoexcept |
Extract an element from the queue.
|
inlinenoexcept |
Check if queue is empty.
|
inline |
Add a new element to the queue.
|
inline |
|
inlinenoexcept |
Check if queue is closed.
|
inlinenoexcept |
Check if queue is closed and empty.