MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
|
#include <ThreadPauser.h>
Public Member Functions | |
ThreadState | GetStateBlockingInner () |
ThreadState | AdvanceStateInner () |
ThreadState | GetAdvanceStateInner (bool innerReadyToAdvance) |
ThreadState | GetStateNonblocking () |
ThreadState | AdvanceStateOuter (ThreadState fromState) |
ThreadPauser () | |
~ThreadPauser () | |
void | RequestPause () |
void | SetIgnoreThreadingProblems (bool value) |
void | RequestRun () |
void | Run () |
bool | IsRunReady () |
bool | IsPauseReady () |
void | Pause () |
void | ReportThreadPauserStatus (Logger::Level level) |
Static Public Member Functions | |
static const char * | GetThreadStateName (ThreadState ts) |
A threading construct which pauses a looping thread by blocking it. It is controlled by what is known as an 'outer' thread (i.e. a thread which tells another to pause), and it controls an 'inner' thread (i.e. the thread to be paused).
MFM::ThreadPauser::ThreadPauser | ( | ) |
Constructs a new ThreadPauser.
MFM::ThreadPauser::~ThreadPauser | ( | ) |
Destroys this ThreadPauser.
ThreadState MFM::ThreadPauser::AdvanceStateOuter | ( | ThreadState | fromState | ) |
Given the ThreadPauser is currently in state fromState, advance it, if necessary, to the next state in the sequence.
Violates an assertion if the ThreadPauser's current state is not fromState.
|
inline |
To be called by the outer thread. Checks to see if the inner thread is ready to be paused.
|
inline |
To be called by the outer thread. Checks to see if the inner thread is ready to be run.
|
inline |
To be called by the outer thread. ThreadPauser must be in state THREADSTATE_PAUSE_READY. This returns immediately and pauses the looping thread.
|
inline |
To be called by the outer thread. This advances the inner thread from THREADSTATE_RUNNING to THREADSTATE_PAUSE_REQUESTED
|
inline |
To be called by the outer thread. This advances the inner thread from THREADSTATE_PAUSED to THREADSTATE_RUN_REQUESTED
|
inline |
To be called by the outer thread. This advances the inner thread from THREADSTATE_RUN_READY to THREADSTATE_RUNNING
|
inline |
Sets whether or not this ThreadPauser is allowed to ignore problems consistent with threading bugs. This is not normally reccomended because it will cause some corruptions, but it may keep your MFM instance from crashing.