libpandac
0.0.0
A library designed for a comm.ai Panda.
|
Abstract class, handles a single thread. Features mutual exclusion and pause/resume. More...
#include <thread.h>
Public Member Functions | |
bool | start () |
Starts the internal thread method. More... | |
void | stop () |
Stops the internal thread method. More... | |
void | WaitForInternalThreadToExit () |
Will wait until the thread has finished. | |
int | lock () |
Performs a mutual exclusion lock. Will halt if locked by another thread, and will resume when the other thread performs an unlock. More... | |
int | unlock () |
Performs a mutual exclusion unlock. Will allow other threads that have been locked to resume. More... | |
void | pause () |
Performs a pause. More... | |
void | resume () |
Resumes the thread from a pause. More... | |
bool | running () |
Returns the state of the thread. More... | |
Protected Member Functions | |
virtual void | entryAction () |
Called once at the beginning of the thread running. More... | |
virtual void | doAction () |
Continuously called until the thread is commanded to stop. More... | |
virtual void | exitAction () |
Called once when thread is commanded to stop. More... | |
void | checkSuspend () |
Blocks the thread from a pause() call until resume() is called. | |
Abstract class, handles a single thread. Features mutual exclusion and pause/resume.
|
protectedvirtual |
Continuously called until the thread is commanded to stop.
If not defined in the base class, the loop will simply exit. Good practice would be to make this non-blocking.
|
protectedvirtual |
Called once at the beginning of the thread running.
Use this to set up data for the thread.
|
protectedvirtual |
Called once when thread is commanded to stop.
Use this to clean up data in the thread, or place into a stopped state.
int Mogi::Thread::lock | ( | ) |
Performs a mutual exclusion lock. Will halt if locked by another thread, and will resume when the other thread performs an unlock.
void Mogi::Thread::pause | ( | ) |
Performs a pause.
void Mogi::Thread::resume | ( | ) |
Resumes the thread from a pause.
|
inline |
Returns the state of the thread.
bool Mogi::Thread::start | ( | ) |
Starts the internal thread method.
void Mogi::Thread::stop | ( | ) |
Stops the internal thread method.
!
int Mogi::Thread::unlock | ( | ) |
Performs a mutual exclusion unlock. Will allow other threads that have been locked to resume.