XII Release 0.1.0
Loading...
Searching...
No Matches
xiiThread Class Referenceabstract

This class is the base class for platform independent long running threads. More...

#include <Thread.h>

Inheritance diagram for xiiThread:
[legend]

Public Types

enum  xiiThreadStatus { Created = 0 , Running , Finished }
 Describes the thread status.
 

Public Member Functions

 xiiThread (xiiStringView sName="xiiThread", xiiUInt32 uiStackSize=128 *1024)
 Initializes the runnable class.
 
virtual ~xiiThread ()
 Destructor checks if the thread is deleted while still running, which is not allowed as this is a data hazard.
 
xiiThreadStatus GetThreadStatus () const
 Returns the thread status.
 
bool IsRunning () const
 Helper function to determine if the thread is running.
 
xiiStringView GetThreadName () const
 Returns the thread name.
 
- Public Member Functions inherited from xiiOSThread
 xiiOSThread (xiiOSThreadEntryPoint threadEntryPoint, void *pUserData=nullptr, xiiStringView sName="xiiOSThread", xiiUInt32 uiStackSize=128 *1024)
 Initializes the thread instance (e.g. thread creation etc.)
 
virtual ~xiiOSThread ()
 Destructor.
 
void Start ()
 Starts the thread.
 
void Join ()
 Waits in the calling thread until the thread has finished execution (e.g. returned from the thread function)
 
const xiiThreadID & GetThreadID () const
 Returns the thread ID of the thread object, may be used in comparison operations with xiiThreadUtils::GetCurrentThreadID() for example.
 

Static Public Member Functions

static const xiiThreadGetCurrentThread ()
 Returns the current xiiThread if the current platform thread is a xiiThread. Returns nullptr otherwise.
 
- Static Public Member Functions inherited from xiiOSThread
static xiiInt32 GetThreadCount ()
 Returns how many xiiOSThreads are currently active.
 

Static Public Attributes

static xiiEvent< const xiiThreadEvent &, xiiMutexs_ThreadEvents
 These events inform about threads starting and finishing.
 

Private Member Functions

virtual xiiUInt32 Run ()=0
 The run function can be used to implement a long running task in a thread in a platform independent way.
 

Friends

xiiUInt32 RunThread (xiiThread *pThread)
 

Additional Inherited Members

- Protected Attributes inherited from xiiOSThread
xiiThreadHandle m_hHandle
 
xiiThreadID m_ThreadID
 
xiiOSThreadEntryPoint m_EntryPoint
 
void * m_pUserData
 
xiiString m_sName
 
xiiUInt32 m_uiStackSize
 

Detailed Description

This class is the base class for platform independent long running threads.

Used by deriving from this class and overriding the Run() method.

Member Function Documentation

◆ Run()

virtual xiiUInt32 xiiThread::Run ( )
privatepure virtual

The run function can be used to implement a long running task in a thread in a platform independent way.

Implemented in xiiProcessThread, xiiRemoteThread, xiiTaskWorkerThread, and xiiThreadWithDispatcher.

Member Data Documentation

◆ s_ThreadEvents

xiiEvent< const xiiThreadEvent &, xiiMutex > xiiThread::s_ThreadEvents
static

These events inform about threads starting and finishing.

The events are raised on the executing thread! That means thread-specific code may be executed during the event callback, e.g. to set up thread-local functionality.


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