OpenCBDC Transaction Processor
|
Thread-safe producer-consumer FIFO queue supporting multiple concurrent producers and consumers. More...
#include <blocking_queue.hpp>
Public Member Functions | |
blocking_queue_internal ()=default | |
blocking_queue_internal (const blocking_queue_internal &)=delete | |
auto | operator= (const blocking_queue_internal &) -> blocking_queue_internal &=delete |
blocking_queue_internal (blocking_queue_internal &&)=delete | |
auto | operator= (blocking_queue_internal &&) -> blocking_queue_internal &=delete |
~blocking_queue_internal () | |
Destructor. | |
auto | push (const T &item) -> size_t |
Pushes an element onto the queue and notifies at most one waiting consumer. | |
auto | pop (T &item) -> bool |
Pops an element from the queue. | |
void | clear () |
Clears the queue and unblocks waiting consumers. | |
void | reset () |
Removes the wakeup flag for consumers. | |
Thread-safe producer-consumer FIFO queue supporting multiple concurrent producers and consumers.
type | of object stored in the queue. |
Definition at line 19 of file blocking_queue.hpp.
|
default |
|
delete |
|
delete |
|
inline |
Destructor.
Clears the queue and unblocks any waiting consumers.
Definition at line 34 of file blocking_queue.hpp.
References cbdc::blocking_queue_internal< T, Q >::clear().
|
inline |
Clears the queue and unblocks waiting consumers.
Definition at line 81 of file blocking_queue.hpp.
Referenced by cbdc::blocking_queue_internal< T, Q >::~blocking_queue_internal().
|
delete |
|
delete |
|
inlinenodiscard |
Pops an element from the queue.
Blocks if the queue is empty. Unblocks on destruction or clear without returning an element.
item | object into which to move the popped element. |
Definition at line 59 of file blocking_queue.hpp.
|
inline |
Pushes an element onto the queue and notifies at most one waiting consumer.
item | object to push onto the queue. |
Definition at line 41 of file blocking_queue.hpp.
|
inline |
Removes the wakeup flag for consumers.
Must be called after clear() before re-using the queue. All consumers must have returned from pop() before calling this method.
Definition at line 93 of file blocking_queue.hpp.