XII Release 0.1.0
Loading...
Searching...
No Matches
xiiTaskWorkerThread Class Referencefinal

Copyright (c) Theophilus Eriata. All Rights Reserved. More...

#include <TaskWorkerThread.h>

Inheritance diagram for xiiTaskWorkerThread:
[legend]

Execution

 xiiTaskWorkerThread (xiiWorkerThreadType::Enum threadType, xiiUInt32 uiThreadNumber)
 Tells the worker thread what tasks to execute and which thread index it has.
xiiResult DeactivateWorker ()
 Deactivates the thread. Returns failure, if the thread is currently still running.
void BroadcastClearThreadLocalsEvent ()
 Broadcasts xiiThreadEvent::ClearThreadLocals on this thread.
void WaitForBroadcastClearTLS ()

Thread Utilization

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

Idle State

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

Additional Inherited Members

Public Types inherited from xiiThread
enum  xiiThreadStatus { Created = 0 , Running , Finished }
 Describes the thread status.
Public Member Functions inherited from xiiThread
 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)
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
Static Public Member Functions inherited from xiiThread
static const xiiThread * GetCurrentThread ()
 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 inherited from xiiThread
static xiiEvent< const xiiThreadEvent &, xiiMutex > s_ThreadEvents
 Copyright (c) Theophilus Eriata. All Rights Reserved.
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

Copyright (c) Theophilus Eriata. All Rights Reserved.

Member Function Documentation

◆ Run()

xiiUInt32 xiiTaskWorkerThread::Run ( )
overrideprivatevirtual

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

Implements xiiThread.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Threading/Implementation/TaskWorkerThread.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Threading/Implementation/TaskWorkerThread.cpp