C++ TargetRTS
|
An object associated with a thread which captures its current state and implements its behavior. More...
#include <RTJob.h>
Public Types | |
enum | Phase { created , running , finished } |
Public Member Functions | |
virtual const char * | name (void) const =0 |
Phase | phase (void) const |
virtual void | mainLoop (void)=0 |
virtual void | kill (void)=0 |
Protected Member Functions | |
void | enter (Phase) |
Protected Attributes | |
RTMutex * | _mutex |
An object associated with a thread which captures its current state and implements its behavior.
When more than one thread of control exists, we need to identify stages in the life of a thread, so that interactions between jobs may be adjusted according to their phases. The class RTJob embodies this abstraction. When a thread is created, it is given an instance of a concrete subclass of RTJob to execute. The new thread signals the completion of its initialization by moving to the running phase. When the job is done, the phase becomes finished which should terminate mainLoop. The thread destructor invokes the kill method to coordinate shutdown.
Example:
RTJob * job = new RTSpecialJob; // some class derived from RTJob RTThread * thread = new RTThread( job, stack_size, priority );
... // other interactions with job
delete thread; delete job;
|
pure virtual |
Implemented in RTController.
|
pure virtual |
Implemented in RTController.