MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Data Structures | Public Member Functions | Static Public Member Functions
MFM::ThreadPauser Class Reference

#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)
 

Detailed Description

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).

Constructor & Destructor Documentation

MFM::ThreadPauser::ThreadPauser ( )

Constructs a new ThreadPauser.

MFM::ThreadPauser::~ThreadPauser ( )

Destroys this ThreadPauser.

Member Function Documentation

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.

Returns
the (now) current state of the ThreadPauser.
bool MFM::ThreadPauser::IsPauseReady ( )
inline

To be called by the outer thread. Checks to see if the inner thread is ready to be paused.

bool MFM::ThreadPauser::IsRunReady ( )
inline

To be called by the outer thread. Checks to see if the inner thread is ready to be run.

void MFM::ThreadPauser::Pause ( )
inline

To be called by the outer thread. ThreadPauser must be in state THREADSTATE_PAUSE_READY. This returns immediately and pauses the looping thread.

void MFM::ThreadPauser::RequestPause ( )
inline

To be called by the outer thread. This advances the inner thread from THREADSTATE_RUNNING to THREADSTATE_PAUSE_REQUESTED

void MFM::ThreadPauser::RequestRun ( )
inline

To be called by the outer thread. This advances the inner thread from THREADSTATE_PAUSED to THREADSTATE_RUN_REQUESTED

void MFM::ThreadPauser::Run ( )
inline

To be called by the outer thread. This advances the inner thread from THREADSTATE_RUN_READY to THREADSTATE_RUNNING

void MFM::ThreadPauser::SetIgnoreThreadingProblems ( bool  value)
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.


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