#include <MPSCQueue.hpp>
Public Member Functions | |
| MPSCQueue () | |
| Constructs an empty MPSCQueue. | |
| ~MPSCQueue () | |
| void | Enqueue (T value) |
| bool | Dequeue (T &result) |
| bool | IsEmpty () const |
| Checks if the queue is empty. | |
Multi-Producer Single-Consumer (MPSC) queue.
The queue enables multiple producers to enqueue items concurrently, while a single consumer can dequeue items. Dequeue operations are lock-free.
| T | The type of items stored in the queue. Must be default-constructible, move-constructible, and move-assignable. |
|
inline |
Destructs the MPSCQueue and releases all resources.
|
inline |
Dequeues a value from the queue. The method is thread-safe and can be called in parallel with producers, but only one consumer should call it.
| result | A reference to store the dequeued value. It will be moved from the queue. |
|
inline |
Enqueues a value into the queue. The method is thread-safe and can be called concurrently by multiple producers.
| value | The value to enqueue. It will be moved into the queue. |