39 #ifndef _PLT_THREADTASK_H_
40 #define _PLT_THREADTASK_H_
74 return NPT_SUCCEEDED(m_Abort.WaitUntilEquals(1, timeout));
85 NPT_TimeInterval* delay = NULL,
86 bool auto_destroy =
true);
91 NPT_Result
Stop(
bool blocking =
true);
122 NPT_Result StartThread();
133 NPT_SharedVariable m_Started;
134 NPT_SharedVariable m_Abort;
135 NPT_Thread* m_Thread;
137 NPT_TimeInterval m_Delay;
virtual void DoInit()
This method to override in derived classes is called when the task is about to start.
Definition: PltThreadTask.h:97
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.
virtual void DoAbort()
This method to override in derived classes is called when the task is about to stop.
Definition: PltThreadTask.h:103
NPT_Result Stop(bool blocking=true)
Stop the task.
The PLT_TaskManager class maintains a list of runnable tasks.
Definition: PltTaskManager.h:60
virtual void DoRun()
This method to override in derived classes is the main task loop.
Definition: PltThreadTask.h:108
virtual bool IsAborting(NPT_Timeout timeout)
Return whether this task is in the process of stopping.
Definition: PltThreadTask.h:73
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 ...
The PLT_ThreadTask class is a base class for executing a given task in a worker thread.
Definition: PltThreadTask.h:56