Thread Class Reference

Base class for thread implementations. More...

List of all members.

Public Member Functions

bool IsRunning () const
 Determine if the thread is running.
void Join ()
 Suspend the calling thread until this thread stops.
void Start ()
 Start the thread execution.
void Stop ()
 Stop the thread execution.
virtual ~Thread ()
 Destructor.

Static Public Member Functions

static simba_uint32 GetThreadId ()
 Get the ID of the calling thread.
static void StartDetachedThread (ThreadFunctionPointer in_threadFunction, void *in_parameters)
 Run a function on a detached thread.

Protected Member Functions

virtual void DoExecute ()=0
 Execution function that will be called from Execute() once the thread starts execution.
virtual void DoStop ()
 Stop function that will be called from Stop().
 Thread (INotifiable *in_notifiable=NULL)
 Constructor.

Protected Attributes

CriticalSection m_criticalSection
 Critical section for the thread.

Detailed Description

Base class for thread implementations.


Constructor & Destructor Documentation

virtual ~Thread (  )  [virtual]

Destructor.

Thread ( INotifiable in_notifiable = NULL  )  [protected]

Constructor.

Parameters:
in_notifiable Object that will be notified when the thread terminates. Can be NULL if no object should be notified. (NOT OWN)

Member Function Documentation

virtual void DoExecute (  )  [protected, pure virtual]

Execution function that will be called from Execute() once the thread starts execution.

Subclasses of Thread should override this function to implement their functionality.

This function should execute until the thread finishes, and then exit to terminate the thread.

virtual void DoStop (  )  [inline, protected, virtual]

Stop function that will be called from Stop().

Subclasses of Thread should override this function to implement any specific functionality. By default nothing happens.

static simba_uint32 GetThreadId (  )  [static]

Get the ID of the calling thread.

Returns:
The ID of the calling thread.
bool IsRunning (  )  const [inline]

Determine if the thread is running.

Returns:
True if the thread is running; false otherwise.
void Join (  ) 

Suspend the calling thread until this thread stops.

void Start (  ) 

Start the thread execution.

Exceptions:
ErrorException if the thread has already been started.
static void StartDetachedThread ( ThreadFunctionPointer  in_threadFunction,
void *  in_parameters 
) [static]

Run a function on a detached thread.

Parameters:
in_threadFunction A pointer to the function to run.
in_parameters A pointer to possible parameters. It is up to the function to interpret the parameters. NULL is allowed.
void Stop (  ) 

Stop the thread execution.

Note that this will not stop the thread immediately, it will wait for the thread execution to check the running flag and stop of its own accord.


Member Data Documentation

Critical section for the thread.


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

Generated on Wed May 17 14:21:19 2017 for SimbaEngine 10.1.3.1011 by simba