Thread-safe queue with blocking and shutdown-aware consumers.
More...
#include <src/thread_safe.h>
|
| bool | peek () |
| | Inspect the next queued value without popping it.
|
| |
| status_t | pop () |
| | Remove and return the next queued item, waiting when requested.
|
| |
| template<class Rep , class Period > |
| status_t | pop (std::chrono::duration< Rep, Period > delay) |
| | Remove and return the next queued item, waiting when requested.
|
| |
| | queue_t (std::uint32_t max_elements=32) |
| | Construct a bounded blocking queue.
|
| |
| template<class... Args> |
| void | raise (Args &&...args) |
| | Notify waiters that a new event value is available.
|
| |
| bool | running () const |
| | Return whether the queue is still running.
|
| |
|
void | stop () |
| | Shut down the queue and wake blocked consumers.
|
| |
| std::vector< T > & | unsafe () |
| | Return the wrapped pointer without synchronization checks.
|
| |
template<class T>
class safe::queue_t< T >
Thread-safe queue with blocking and shutdown-aware consumers.
◆ queue_t()
Construct a bounded blocking queue.
- Parameters
-
| max_elements | Maximum number of queued elements before producers block. |
◆ peek()
Inspect the next queued value without popping it.
- Returns
- True when a value is available to inspect.
◆ pop() [1/2]
Remove and return the next queued item, waiting when requested.
- Returns
- Removed queue item, or empty result when the queue is stopped or empty.
◆ pop() [2/2]
template<class T >
template<class Rep , class Period >
Remove and return the next queued item, waiting when requested.
- Parameters
-
| delay | Maximum wait duration before timing out. |
- Returns
- Removed queue item, or empty result when the queue is stopped or empty.
◆ raise()
template<class T >
template<class... Args>
Notify waiters that a new event value is available.
- Parameters
-
| args | Arguments forwarded to the callable or parser. |
◆ running()
Return whether the queue is still running.
- Returns
- True while the queue accepts producers and consumers.
◆ unsafe()
Return the wrapped pointer without synchronization checks.
- Returns
- Mutable queue storage for callers that already hold external synchronization.
The documentation for this class was generated from the following file: