A queue with tasks executed in a dedicated thread. More...
#include <worker.hpp>
Classes | |
class | WorkerQueue |
Public Types | |
typedef std::shared_ptr< Worker > | Pointer |
typedef std::function< void()> | Task |
Public Member Functions | |
~Worker () | |
Pointer | createSubWorker () |
Creates a worker that share a thread with its parent. More... | |
void | addTask (const Task &task) |
Adds a task to the queue. More... | |
void | addTaskAndWait (const Task &task) |
Static Public Member Functions | |
static Pointer | create () |
Creates a worker with its own thread. More... | |
Private Types | |
typedef unsigned int | GroupID |
Private Member Functions | |
Worker (const std::shared_ptr< WorkerQueue > &workerQueue) | |
Private Attributes | |
const std::shared_ptr < WorkerQueue > | mWorkerQueue |
const GroupID | mGroupID |
A queue with tasks executed in a dedicated thread.
Current implementation creates a thread on the first use.
|
private |
typedef std::shared_ptr<Worker> utils::Worker::Pointer |
typedef std::function<void()> utils::Worker::Task |
utils::Worker::~Worker | ( | ) |
|
private |
void utils::Worker::addTask | ( | const Task & | task | ) |
Adds a task to the queue.
void utils::Worker::addTaskAndWait | ( | const Task & | task | ) |
|
static |
Creates a worker with its own thread.
Worker::Pointer utils::Worker::createSubWorker | ( | ) |
Creates a worker that share a thread with its parent.
|
private |
|
private |