A wrapper for std::priority_queue that serialises operations using a mutex.
More...
#include <TaskQueue.hpp>
A wrapper for std::priority_queue that serialises operations using a mutex.
- Note
- This may be a candidate for future improvements if performance proves to be poor (e.g. use a lock free queue)
◆ TaskQueue()
etlng::impl::TaskQueue::TaskQueue |
( |
Settings | settings | ) |
|
|
inlineexplicit |
Construct a new priority queue.
- Parameters
-
settings | Settings for the queue, including starting sequence, increment value, and optional limit |
- Note
- If limit is not set, the queue will have no limit
◆ awaitTask()
void etlng::impl::TaskQueue::awaitTask |
( |
| ) |
|
|
inline |
Awaits for the queue to become non-empty.
- Note
- This function blocks until there is a task or the queue is being destroyed
◆ dequeue()
Dequeue the next available item out of the queue.
- Note
- This function blocks until the item is taken off the queue
- Returns
- An item if available; nullopt otherwise
◆ empty()
bool etlng::impl::TaskQueue::empty |
( |
| ) |
|
|
inlinenodiscard |
Check if the queue is empty.
- Note
- This function blocks until the queue is checked
- Returns
- true if the queue is empty; false otherwise
◆ enqueue()
Enqueue a new item onto the queue if space is available.
- Note
- This function blocks until the item is attempted to be added to the queue
- Parameters
-
- Returns
- true if item added to the queue; false otherwise
◆ stop()
void etlng::impl::TaskQueue::stop |
( |
| ) |
|
|
inline |
Notify the queue that it's no longer needed.
- Note
- This must be called before the queue is destroyed
The documentation for this class was generated from the following file: