![]() |
VR-Link API Documentation for DIS
|
Declares the DtRunnable class for defining a object that can be run in a thread. More...
Inheritance diagram for DtRunnable:
Collaboration diagram for DtRunnable:Public Member Functions | |
| DtRunnable () | |
| Constructor. More... | |
| virtual | ~DtRunnable () |
| Destructor. More... | |
| virtual void | run ()=0 |
| Abstract function that will be called when the thread is started. More... | |
| virtual void | stop () |
| Function that will be called when the thread is told to stop. More... | |
| bool | timeToStop () |
| Time to stop function which returns TRUE if it is time to stop execution. More... | |
Protected Member Functions | |
| void | execute (volatile bool *stopFlag) |
| Protected execute function which calls run. More... | |
Protected Attributes | |
| volatile bool * | myStopFlag |
| Pointer to the stop flag. More... | |
Friends | |
| class | DtThreadStart |
Declares the DtRunnable class for defining a object that can be run in a thread.
DtRunnable is the defined interface for an object that can be run in a thread. To create a runnable class extend the DtRunnable class and implement the run function. It is important for code that can take considerable time to query the timeToStop() function in all loops, especially infinite loops. There is no safe way to terminate a thread thus to write multi-threading code it is important to allow the controlling thread to safely terminate a child thread.
| DtRunnable::DtRunnable | ( | ) |
Constructor.
|
virtual |
Destructor.
|
protected |
Protected execute function which calls run.
|
pure virtual |
Abstract function that will be called when the thread is started.
Implemented in DtIoServiceRunnable.
|
virtual |
Function that will be called when the thread is told to stop.
Override this function to stop without polling timeToStop.
| bool DtRunnable::timeToStop | ( | ) |
Time to stop function which returns TRUE if it is time to stop execution.
|
friend |
|
protected |
Pointer to the stop flag.