Plasma Engine  2.0
Loading...
Searching...
No Matches
plTaskWorkerThread Class Referencefinal
Inheritance diagram for plTaskWorkerThread:

Execution

 plTaskWorkerThread (plWorkerThreadType::Enum threadType, plUInt32 uiThreadNumber)
 Tells the worker thread what tasks to execute and which thread index it has.
 
plResult DeactivateWorker ()
 Deactivates the thread. Returns failure, if the thread is currently still running.
 

Thread Utilization

double GetThreadUtilization (plUInt32 *pNumTasksExecuted=nullptr)
 Returns the last utilization value (0 - 1 range). Optionally returns how many tasks it executed recently.
 
void UpdateThreadUtilization (plTime timePassed)
 Computes the thread utilization by dividing the thread active time by the time that has passed since the last update.
 

Idle State

virtual plUInt32 Run () override
 The run function can be used to implement a long running task in a thread in a platform independent way.
 
plTaskWorkerState WakeUpIfIdle ()
 If the thread is currently idle, this will wake it up and return PL_SUCCESS.
 

Additional Inherited Members

- Public Types inherited from plThread
enum  plThreadStatus { Created = 0 , Running , Finished }
 Describes the thread status.
 
- Public Member Functions inherited from plThread
 plThread (plStringView sName="plThread", plUInt32 uiStackSize=128 *1024)
 Initializes the runnable class.
 
virtual ~plThread ()
 Destructor checks if the thread is deleted while still running, which is not allowed as this is a data hazard.
 
plThreadStatus GetThreadStatus () const
 Returns the thread status.
 
bool IsRunning () const
 Helper function to determine if the thread is running.
 
const char * GetThreadName () const
 Returns the thread name.
 
- Public Member Functions inherited from plOSThread
 plOSThread (plOSThreadEntryPoint threadEntryPoint, void *pUserData=nullptr, plStringView sName="plOSThread", plUInt32 uiStackSize=128 *1024)
 Initializes the thread instance (e.g. thread creation etc.)
 
virtual ~plOSThread ()
 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 plThreadID & GetThreadID () const
 Returns the thread ID of the thread object, may be used in comparison operations with plThreadUtils::GetCurrentThreadID() for example.
 
- Static Public Member Functions inherited from plThread
static const plThreadGetCurrentThread ()
 Returns the current plThread if the current platform thread is an plThread. Returns nullptr otherwise.
 
- Static Public Member Functions inherited from plOSThread
static plInt32 GetThreadCount ()
 Returns how many plOSThreads are currently active.
 
- Static Public Attributes inherited from plThread
static plEvent< const plThreadEvent &, plMutexs_ThreadEvents
 These events inform about threads starting and finishing.
 
- Protected Attributes inherited from plOSThread
plThreadHandle m_hHandle
 
plThreadID m_ThreadID
 
plOSThreadEntryPoint m_EntryPoint
 
void * m_pUserData
 
plString m_sName
 
plUInt32 m_uiStackSize
 

Member Function Documentation

◆ Run()

plUInt32 plTaskWorkerThread::Run ( )
overrideprivatevirtual

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

Implements plThread.


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