#include <WsfThread.hpp>
◆ FunctionType
| Enumerator |
|---|
| STOPPED | |
| AVAILABLE | |
| ASSIGNED | |
| PAUSED | |
| CRITICAL | |
◆ WsfThread()
◆ ~WsfThread()
| WsfThread::~WsfThread |
( |
| ) |
|
|
overridedefault |
◆ AssignWork()
| bool WsfThread::AssignWork |
( |
| ) |
|
|
inline |
◆ Available()
| void WsfThread::Available |
( |
| ) |
|
|
virtual |
Methods called by the thread's Run() method.
Define what happens when the thread is in the AVAILABLE state. The default is to do nothing.
- Note
- This method does not return the next state of the thread, as this easily leads to a race condition. Instead, use the WsfThread::AssignWork and WsfThread::StopWork methods to transition to other states.
References AVAILABLE, and mFunctionWriteMutex.
Referenced by Run().
◆ BeginCriticalWork()
| bool WsfThread::BeginCriticalWork |
( |
| ) |
|
|
protected |
◆ CriticalWork()
| bool WsfThread::CriticalWork |
( |
| ) |
const |
|
inline |
◆ DoWork()
The user defines the processing to be performed during the ASSIGNED state by implementing this method.
- Returns
- The FunctionType defining the state the thread will be in after completion of the work. If the work is complete, return either AVAILABLE or PAUSED; otherwise return ASSIGNED.
Implemented in WsfDisIO_Thread, and WsfMultiThreadManager::SimulationUpdateThread.
Referenced by Run().
◆ EndCriticalWork()
| bool WsfThread::EndCriticalWork |
( |
| ) |
|
|
protected |
◆ EndThread()
| void WsfThread::EndThread |
( |
| ) |
|
◆ ForceStopWork()
| bool WsfThread::ForceStopWork |
( |
| ) |
|
◆ GetFunction()
◆ Pause()
◆ PauseWork()
| bool WsfThread::PauseWork |
( |
| ) |
|
◆ ReadyForWork()
| bool WsfThread::ReadyForWork |
( |
| ) |
const |
|
inline |
◆ Run()
This method is the main thread function. It calls all other methods that are part of this thread. The while loop will execute until the 'end thread' flag is set externally to this method or the thread function is set to stopped internally by this method. Either one will then cause this function return, ending the thread.
References ASSIGNED, AVAILABLE, Available(), DoWork(), mFunctionWriteMutex, mWorkDoneCond, Pause(), PAUSED, SetFunction(), and STOPPED.
Referenced by ~WsfThread().
◆ SetFunction()
◆ Stopped()
| bool WsfThread::Stopped |
( |
| ) |
const |
|
inline |
◆ StopWork()
| bool WsfThread::StopWork |
( |
| ) |
|
|
inline |
◆ TryWaitUntilWorkDone()
| bool WsfThread::TryWaitUntilWorkDone |
( |
double | aTimeoutSecs | ) |
|
◆ WaitUntilWorkDone()
| void WsfThread::WaitUntilWorkDone |
( |
| ) |
|
◆ mFunctionWriteMutex
| std::mutex WsfThread::mFunctionWriteMutex |
|
protected |
◆ mSavedState
◆ mWorkDoneCond
| std::condition_variable WsfThread::mWorkDoneCond |
|
protected |
The documentation for this class was generated from the following files: