3#include <Foundation/Containers/HybridArray.h>
4#include <Foundation/Threading/ConditionVariable.h>
5#include <Foundation/Time/Time.h>
6#include <Foundation/Types/Delegate.h>
7#include <Foundation/Types/SharedPtr.h>
8#include <Foundation/Types/UniquePtr.h>
109 PL_ALWAYS_INLINE
bool IsValid()
const {
return m_pTaskGroup !=
nullptr; }
112 PL_ALWAYS_INLINE
void Invalidate() { m_pTaskGroup =
nullptr; }
114 PL_ALWAYS_INLINE
bool operator==(
const plTaskGroupID& other)
const
116 return m_pTaskGroup == other.m_pTaskGroup && m_uiGroupCounter == other.m_uiGroupCounter;
118 PL_ALWAYS_INLINE
bool operator!=(
const plTaskGroupID& other)
const
120 return m_pTaskGroup != other.m_pTaskGroup || m_uiGroupCounter != other.m_uiGroupCounter;
122 PL_ALWAYS_INLINE
bool operator<(
const plTaskGroupID& other)
const
124 return m_pTaskGroup < other.m_pTaskGroup || (m_pTaskGroup == other.m_pTaskGroup && m_uiGroupCounter < other.m_uiGroupCounter);
133 plUInt32 m_uiGroupCounter = 0;
147 PL_DECLARE_POD_TYPE();
159enum class plTaskNesting
173 plUInt32 m_uiBinSize = 1;
181 plUInt32 m_uiMaxTasksPerThread = 2;
183 plTaskNesting m_NestingMode = plTaskNesting::Never;
188 void DetermineThreading(plUInt64 uiNumItemsToExecute, plUInt32& out_uiNumTasksToRun, plUInt64& out_uiNumItemsPerTask)
const;
194template <
typename ElemType>
197enum class plTaskWorkerState
Base class for all memory allocators.
Definition Allocator.h:23
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
This class encapsulates building a DGML compatible graph.
Definition DGMLWriter.h:10
A Shared ptr manages a shared object and destroys that object when no one references it anymore....
Definition SharedPtr.h:10
Definition TaskGroup.h:11
Given out by plTaskSystem::CreateTaskGroup to identify a task group.
Definition TaskSystemDeclarations.h:103
PL_ALWAYS_INLINE bool IsValid() const
Returns false, if the GroupID does not reference a valid plTaskGroup.
Definition TaskSystemDeclarations.h:109
PL_ALWAYS_INLINE void Invalidate()
Resets the GroupID into an invalid state.
Definition TaskSystemDeclarations.h:112
Base class for custom tasks.
Definition Task.h:10
This system allows to automatically distribute tasks onto a number of worker threads.
Definition TaskSystem.h:25
Definition TaskSystemState.h:22
Definition TaskSystemState.h:6
Definition TaskWorkerThread.h:10
Enum that describes what to do when waiting for or canceling tasks, that have already started executi...
Definition TaskSystemDeclarations.h:77
Settings for plTaskSystem::ParallelFor invocations.
Definition TaskSystemDeclarations.h:167
Definition TaskSystemDeclarations.h:146
Describes the priority with which to execute a task.
Definition TaskSystemDeclarations.h:38
Enum
Definition TaskSystemDeclarations.h:41
@ LongRunningHighPriority
Definition TaskSystemDeclarations.h:58
@ LateThisFrame
Low priority, guaranteed to get finished in this frame.
Definition TaskSystemDeclarations.h:44
@ In6Frames
A short task that should be finished no later than in 6 frames.
Definition TaskSystemDeclarations.h:53
@ ThisFrameMainThread
Definition TaskSystemDeclarations.h:65
@ In3Frames
A short task that should be finished no later than in 3 frames.
Definition TaskSystemDeclarations.h:50
@ ThisFrame
Medium priority, guaranteed to get finished in this frame.
Definition TaskSystemDeclarations.h:43
@ In7Frames
A short task that should be finished no later than in 7 frames.
Definition TaskSystemDeclarations.h:54
@ SomeFrameMainThread
Definition TaskSystemDeclarations.h:67
@ LongRunning
Use this priority for tasks that might run for a while.
Definition TaskSystemDeclarations.h:60
@ In5Frames
A short task that should be finished no later than in 5 frames.
Definition TaskSystemDeclarations.h:52
@ In8Frames
A short task that should be finished no later than in 8 frames.
Definition TaskSystemDeclarations.h:55
@ EarlyNextFrame
Highest priority in next frame, guaranteed to get finished this frame or the next.
Definition TaskSystemDeclarations.h:45
@ In4Frames
A short task that should be finished no later than in 4 frames.
Definition TaskSystemDeclarations.h:51
@ In2Frames
A short task that should be finished no later than in 2 frames.
Definition TaskSystemDeclarations.h:49
@ EarlyThisFrame
Highest priority, guaranteed to get finished in this frame.
Definition TaskSystemDeclarations.h:42
@ FileAccess
Definition TaskSystemDeclarations.h:63
@ LateNextFrame
Low priority in next frame, guaranteed to get finished this frame or the next.
Definition TaskSystemDeclarations.h:47
@ FileAccessHighPriority
Definition TaskSystemDeclarations.h:61
@ In9Frames
A short task that should be finished no later than in 9 frames.
Definition TaskSystemDeclarations.h:56
@ NextFrame
Medium priority in next frame, guaranteed to get finished this frame or the next.
Definition TaskSystemDeclarations.h:46
Definition TaskSystemDeclarations.h:87
Enum
Definition TaskSystemDeclarations.h:89
@ Unknown
Default for all non-plTaskSystem-worker threads. Will only execute short tasks.
Definition TaskSystemDeclarations.h:90
@ MainThread
May only be used by the main thread (automatically used by the plTaskSystem)
Definition TaskSystemDeclarations.h:91