C++ TargetRTS
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RTJob Class Referenceabstract

An object associated with a thread which captures its current state and implements its behavior. More...

#include <RTJob.h>

Inheritance diagram for RTJob:
RTController RTDebugger RTPeerController RTSoleController RTAbortController RTCustomController RTTimerController

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
 

Detailed Description

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;

Member Function Documentation

◆ kill()

virtual void RTJob::kill ( void  )
pure virtual

Implemented in RTController.

◆ name()

virtual const char * RTJob::name ( void  ) const
pure virtual

Implemented in RTController.


The documentation for this class was generated from the following files: