VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Friends
DtRunnable Class Reference

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.
virtual ~DtRunnable ()
 Destructor.
virtual void run ()=0
 Abstract function that will be called when the thread is started.
virtual void stop ()
 Function that will be called when the thread is told to stop.
bool timeToStop ()
 Time to stop function which returns TRUE if it is time to stop execution.

Protected Member Functions

void execute (volatile bool *stopFlag)
 Protected execute function which calls run.

Protected Attributes

volatile boolmyStopFlag
 Pointer to the stop flag.

Friends

class DtThreadStart

Detailed Description

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.

Constructor & Destructor Documentation

DtRunnable::DtRunnable ( )

Constructor.

virtual DtRunnable::~DtRunnable ( )
virtual

Destructor.

Member Function Documentation

void DtRunnable::execute ( volatile bool stopFlag)
protected

Protected execute function which calls run.

virtual void DtRunnable::run ( )
pure virtual

Abstract function that will be called when the thread is started.

Implemented in DtIoServiceRunnable.

virtual void DtRunnable::stop ( )
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.

Friends And Related Function Documentation

friend class DtThreadStart
friend

Member Data Documentation

volatile bool* DtRunnable::myStopFlag
protected

Pointer to the stop flag.


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

Document ID: Generated on Mon Apr 8 04:49:21 EDT 2019 from SVN revision 197403
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)