|
Lightweight 0.20251202.0
|
#include <ThreadSafeQueue.hpp>
Public Member Functions | |
| void | Push (T item) |
| bool | WaitAndPop (T &item) |
| void | MarkFinished () |
| bool | Empty () const |
| size_t | Size () const |
Thread-safe queue with blocking wait semantics.
This queue allows multiple producer and consumer threads to safely enqueue and dequeue items. Consumers block on WaitAndPop until an item is available or the queue is marked as finished.
| T | The type of items stored in the queue. |
Definition at line 20 of file ThreadSafeQueue.hpp.
|
inline |
Pushes an item onto the queue and notifies one waiting consumer.
| item | The item to push onto the queue. |
Definition at line 26 of file ThreadSafeQueue.hpp.
|
inline |
Blocks until an item is available or the queue is finished.
This method will block the calling thread until either:
| item | Output parameter to receive the popped item. |
Definition at line 43 of file ThreadSafeQueue.hpp.
|
inline |
Signals that no more items will be added.
After this call, WaitAndPop will return false once the queue is empty. All waiting consumers will be notified.
Definition at line 58 of file ThreadSafeQueue.hpp.
|
inline |
Checks if the queue is empty.
Definition at line 70 of file ThreadSafeQueue.hpp.
|
inline |
Returns the current size of the queue.
Definition at line 79 of file ThreadSafeQueue.hpp.