|
| bool | Finished () |
| | Return true, if the queue is stopped and empty, else false.
|
| ProcessingQueue & | operator= (const ProcessingQueue &)=delete |
| std::optional< T > | PopTask () |
| | Move one data entry out of the queue (FIFO semantics).
|
| | ProcessingQueue () |
| | Initialize a unbounded queue.
|
| | ProcessingQueue (const ProcessingQueue &)=delete |
| | ProcessingQueue (size_t queueLimit) |
| | Initialize a bounded queue.
|
| void | PushTask (const T &task) |
| | Push a copy of the given data into the queue.
|
| void | PushTask (T &&task) |
| | Push a copy or move the given data into the queue.
|
| void | Stop () |
| | Signal that all data has been pushed into the queue.
|
| void | StopAndDiscard () |
| | Stop the queue and drop the data that has not been popped yet, in one step, so that a consumer returning from its current item cannot pick up one of the dropped items.
|
| virtual | ~ProcessingQueue ()=default |
template<typename T>
class osmscout::ProcessingQueue< T >
A ProcessingQueue is a special multi-threaded safe implementation of a queue.
The goal is to use this queues as a asynchronous pipeline between individual agents or worker threads.
The queue has FIFO semantics.
A queue can have multiple producers and consumers. There is currently no Peek() method data that has been taken has either to be consumed, pushed back or dropped.
The queue data should be movable but can be copyable also. If the content is not movable additional CPU overhead for copying data is to be expected.
Note that even is the content is moveable is should be assumed that moving data through the queue has it own cost.
- Template Parameters
-
| T | Type of the queue content |
Stop the queue and drop the data that has not been popped yet, in one step, so that a consumer returning from its current item cannot pick up one of the dropped items.
Discard all data that has not been popped yet, so that work that did not start does not run.
Meant for shutdown; Stop() alone keeps the data that is already queued.
Meant for shutdown, next to Stop().
- Template Parameters
-