The PLT_ThreadTask class is a base class for executing a given task in a worker thread.
More...
#include <PltThreadTask.h>
|
NPT_Result | Kill () |
| When a task is not managed by a PLT_TaskManager, the owner must call this to stop and destroy it.
|
|
|
| PLT_ThreadTask () |
| A PLT_ThreadTask base class is never instantiated directly.
|
|
virtual | ~PLT_ThreadTask () |
| The task manager will destroy the task when finished if m_AutoDestroy is true otherwise the owner of this task must use the Kill method.
|
|
virtual void | DoAbort () |
| This method to override in derived classes is called when the task is about to stop.
|
|
virtual void | DoInit () |
| This method to override in derived classes is called when the task is about to start.
|
|
virtual void | DoRun () |
| This method to override in derived classes is the main task loop.
|
|
virtual bool | IsAborting (NPT_Timeout timeout) |
| Return whether this task is in the process of stopping.
|
|
NPT_Result | Start (PLT_TaskManager *task_manager=NULL, NPT_TimeInterval *delay=NULL, bool auto_destroy=true) |
| Start a task by associating it with a task manager.
|
|
NPT_Result | Stop (bool blocking=true) |
| Stop the task.
|
|
The PLT_ThreadTask class is a base class for executing a given task in a worker thread.
A PLT_ThreadTask is usually always associated to a PLT_TaskManager which maintains a list to stop and destroy tasks when finished.
PLT_ThreadTask::PLT_ThreadTask |
( |
| ) |
|
|
protected |
virtual PLT_ThreadTask::~PLT_ThreadTask |
( |
| ) |
|
|
protectedvirtual |
The task manager will destroy the task when finished if m_AutoDestroy is true otherwise the owner of this task must use the Kill method.
virtual void PLT_ThreadTask::DoAbort |
( |
| ) |
|
|
inlineprotectedvirtual |
virtual void PLT_ThreadTask::DoInit |
( |
| ) |
|
|
inlineprotectedvirtual |
This method to override in derived classes is called when the task is about to start.
virtual void PLT_ThreadTask::DoRun |
( |
| ) |
|
|
inlineprotectedvirtual |
virtual bool PLT_ThreadTask::IsAborting |
( |
NPT_Timeout |
timeout | ) |
|
|
inlineprotectedvirtual |
Return whether this task is in the process of stopping.
- Parameters
-
timeout | number of milliseconds to wait |
- Returns
- boolean indicating if the task is stopping
NPT_Result PLT_ThreadTask::Kill |
( |
| ) |
|
When a task is not managed by a PLT_TaskManager, the owner must call this to stop and destroy it.
NPT_Result PLT_ThreadTask::Start |
( |
PLT_TaskManager * |
task_manager = NULL , |
|
|
NPT_TimeInterval * |
delay = NULL , |
|
|
bool |
auto_destroy = true |
|
) |
| |
|
protected |
Start a task by associating it with a task manager.
- Parameters
-
task_manager | PLT_TaskManager pointer |
delay | optional time interval to wait before launching the new task |
auto_destroy | a flag to indicate if the task is owned by someone else and thus should not destroy itself when done. |
NPT_Result PLT_ThreadTask::Stop |
( |
bool |
blocking = true | ) |
|
|
protected |
Stop the task.
This is either called by a task manager or the Kill method.
- Parameters
-
blocking | Whether the method should block until the task has finished. |
The documentation for this class was generated from the following file: