![]() |
Laelaps
2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
|
Asynchronous job base class. More...
#include <laeThreadAsync.h>
Public Types | |
| enum | JobState { JobStateNoJob, JobStateCreated, JobStateReady, JobStateRunning, JobStateTerminated } |
| Job states. More... | |
Public Member Functions | |
| LaeAsyncJob (const std::string strJobName="Job") | |
| Default constructor. | |
| virtual | ~LaeAsyncJob () |
| Destructor. | |
| virtual void | getReady () |
| Get ready to run. More... | |
| virtual void | start () |
| Start. More... | |
| virtual int | run () |
| Run the job. More... | |
| virtual void | terminate () |
| Terminate the job normally. | |
| virtual void | abort (int rc=-LAE_ECODE_INTR) |
| Abort the job. More... | |
| JobState | getState () |
| Get the current job state. More... | |
| std::string | getJobName () |
| Get the name of the job. More... | |
| bool | isDone () |
| Test if job has completed or should be aborted. More... | |
| int | getRc () |
| Get job's return code. More... | |
Protected Attributes | |
| JobState | m_eJobState |
| job state | |
| std::string | m_strJobName |
| job name | |
| bool | m_bIsDone |
| job is [not] done | |
| int | m_nJobRc |
| job return code | |
Asynchronous job base class.
Definition at line 81 of file laeThreadAsync.h.
| enum laelaps::LaeAsyncJob::JobState |
Job states.
Definition at line 87 of file laeThreadAsync.h.
|
virtual |
Abort the job.
The abort is called when an error occurs or the thread is asynchronously terminated.
| rc | Job error exit return code. |
Definition at line 104 of file laeThreadAsync.cxx.
References JobStateTerminated, m_bIsDone, m_eJobState, m_nJobRc, laelaps::LaeThreadAsync::ThreadAsyncHzDft, laelaps::LaeThreadAsync::ThreadAsyncNameDft, and laelaps::LaeThreadAsync::ThreadAsyncPrioDft.
Referenced by laelaps::LaeThreadAsync::createThread(), laelaps::LaeThreadAsync::exec(), laelaps::LaeThreadAsync::terminateThread(), laelaps::LaeThreadAsync::transToExit(), and laelaps::LaeThreadAsync::~LaeThreadAsync().
|
inline |
Get the name of the job.
Definition at line 161 of file laeThreadAsync.h.
References m_strJobName.
Referenced by laelaps::LaeThreadAsync::createThread().
|
inline |
Get job's return code.
Definition at line 181 of file laeThreadAsync.h.
References m_nJobRc.
Referenced by laelaps::LaeRobot::getAsyncJobRc().
|
virtual |
Get ready to run.
Called after job is attached to the thread and is ready to run.
Definition at line 81 of file laeThreadAsync.cxx.
References JobStateReady, and m_eJobState.
Referenced by laelaps::LaeThreadAsync::transToReady().
|
inline |
Get the current job state.
Definition at line 151 of file laeThreadAsync.h.
References m_eJobState.
Referenced by laelaps::LaeRobot::getAsyncJobState().
|
inline |
Test if job has completed or should be aborted.
Definition at line 171 of file laeThreadAsync.h.
References m_bIsDone.
Referenced by laelaps::LaeThreadAsync::exec(), laelaps::LaeThreadAsync::terminateThread(), laelaps::LaeThreadAsync::transToExit(), and laelaps::LaeThreadAsync::~LaeThreadAsync().
|
virtual |
Run the job.
The job can be time sliced, given that it is attached to a thread with a built-in scheduler, or it can run to completion in a single execution block.
Definition at line 91 of file laeThreadAsync.cxx.
References laelaps::LAE_ECODE_NO_EXEC, and m_nJobRc.
Referenced by laelaps::LaeThreadAsync::exec().
|
virtual |
Start.
Called just prior to the attached thread starts execution.
Definition at line 86 of file laeThreadAsync.cxx.
References JobStateRunning, and m_eJobState.
Referenced by laelaps::LaeThreadAsync::transToRunning().