3#include <Foundation/Threading/Implementation/TaskSystemDeclarations.h>
5#include <Foundation/Threading/Thread.h>
6#include <Foundation/Threading/ThreadSignal.h>
29 volatile bool m_bActive =
true;
32 plUInt16 m_uiWorkerThreadNumber = 0xFFFF;
47 bool m_bExecutingTask =
false;
48 plUInt16 m_uiLastNumTasksExecuted = 0;
49 plUInt16 m_uiNumTasksExecuted = 0;
50 plTime m_StartedWorkingTime;
52 double m_fLastThreadUtilization = 0.0;
67 virtual plUInt32
Run()
override;
84 bool m_bAllowNestedTasks =
true;
85 plInt32 m_iWorkerIndex = -1;
86 const char* m_szTaskName =
nullptr;
Definition TaskWorkerThread.h:10
double GetThreadUtilization(plUInt32 *pNumTasksExecuted=nullptr)
Returns the last utilization value (0 - 1 range). Optionally returns how many tasks it executed recen...
Definition TaskWorkerThread.cpp:140
plTaskWorkerState WakeUpIfIdle()
If the thread is currently idle, this will wake it up and return PL_SUCCESS.
Definition TaskWorkerThread.cpp:107
void UpdateThreadUtilization(plTime timePassed)
Computes the thread utilization by dividing the thread active time by the time that has passed since ...
Definition TaskWorkerThread.cpp:118
virtual plUInt32 Run() override
The run function can be used to implement a long running task in a thread in a platform independent w...
Definition TaskWorkerThread.cpp:41
plTaskWorkerThread(plWorkerThreadType::Enum threadType, plUInt32 uiThreadNumber)
Tells the worker thread what tasks to execute and which thread index it has.
Definition TaskWorkerThread.cpp:16
plResult DeactivateWorker()
Deactivates the thread. Returns failure, if the thread is currently still running.
Definition TaskWorkerThread.cpp:26
This class is the base class for platform independent long running threads.
Definition Thread.h:40
Waiting on a thread signal puts the waiting thread to sleep. Other threads can wake it up by raising ...
Definition ThreadSignal.h:19
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
Definition TaskWorkerThread.h:82
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
Enum
Definition TaskSystemDeclarations.h:89
@ Unknown
Default for all non-plTaskSystem-worker threads. Will only execute short tasks.
Definition TaskSystemDeclarations.h:90