#include </opt/build/repo/nap/utility/src/utility/threading.h>
Public Types | |
using | Task = std::function< void()> |
Public Member Functions | |
TaskQueue (int maxQueueItems=20) | |
bool | enqueue (Task task) |
void | processBlocking () |
void | process () |
Thread safe queue for tasks that are encapsulated in function objects. It is possible to enqueue tasks at the end of the queue and to execute the tasks in the queue.
using Task = std::function<void()> |
TaskQueue | ( | int | maxQueueItems = 20 | ) |
Constructor takes maximum number of items that can be in the queue at a time.
bool enqueue | ( | Task | task | ) |
Add a task to the end of the queue.
void process | ( | ) |
Executes all tasks currently in the queue
void processBlocking | ( | ) |
If the queue is empty, this function blocks until tasks are enqueued and executes them. If the queue is not empty all the tasks are executed.