Quark
0.1
|
An object that executes Tasks in a queue on a dedicated thread. More...
#include <TaskProcessor.h++>
Signals | |
void | busyStateChanged (bool busy) |
Emitted whenever the TaskProcessor switches between idle and busy state. More... | |
Public Member Functions | |
TaskProcessor (QObject *parent=NULL) | |
Constructs a new TaskProcessor. More... | |
virtual | ~TaskProcessor () |
Destructor. More... | |
int | addTask (Task *task) |
Adds a task to the queue. More... | |
bool | cancelTask (int taskId) |
Attempts to cancel a scheduled (or executing) task. More... | |
bool | stop () |
Stops the task processor. More... | |
An object that executes Tasks in a queue on a dedicated thread.
The QThread start() method should be called to start the processing thread.
TaskProcessor | ( | QObject * | parent = NULL | ) |
Constructs a new TaskProcessor.
|
virtual |
Destructor.
int addTask | ( | Task * | task | ) |
Adds a task to the queue.
task | The task. |
|
signal |
Emitted whenever the TaskProcessor switches between idle and busy state.
The TaskProcessor is "idle" when its task queue is empty.
busy | Whether the TaskProcessor is busy. |
bool cancelTask | ( | int | taskId | ) |
Attempts to cancel a scheduled (or executing) task.
taskId | The unique ID of the task, as returned by addTask(). |
bool stop | ( | ) |
Stops the task processor.
Attempts to cancel all tasks in the queue, then stops the thread.