ezEngine  Milestone 7
ezTaskPriority Struct Reference

Describes the priority with which to execute a task. More...

#include <TaskSystemDeclarations.h>

Public Types

enum  Enum {
  EarlyThisFrame, ThisFrame, LateThisFrame, EarlyNextFrame,
  NextFrame, LateNextFrame, LongRunningHighPriority, LongRunning,
  FileAccessHighPriority, FileAccess, ThisFrameMainThread, SomeFrameMainThread,
  ENUM_COUNT
}
 

Detailed Description

Describes the priority with which to execute a task.

For tasks that you start this frame and that need to finish within the same frame, use 'EarlyThisFrame', 'ThisFrame' or 'LateThisFrame'.
However you should generally not rely on starting tasks in the same frame in which they need to finish.
Instead prefer to start a task, whose result you need in the next frame.
For those tasks, use 'EarlyNextFrame', 'NextFrame' and 'LateNextFrame'.
Once 'ezTaskSystem::FinishFrameTasks' is called, all those tasks will be moved into the 'XYZThisFrame' categories.
For tasks that run over a longer period (e.g. path searches, procedural data creation), use 'LongRunning'. Only use 'LongRunningHighPriority' for tasks that occur rarely, otherwise 'LongRunning' tasks might not get processed, at all.
For tasks that need to access files, prefer to use 'FileAccess', this way all file accesses get executed sequentially.
Use 'FileAccessHighPriority' to get very important file accesses done sooner. For example writing out a save-game should finish quickly.
For tasks that need to execute on the main thread (e.g. uploading GPU resources) use 'ThisFrameMainThread' or 'SomeFrameMainThread' depending on how urgent it is. 'SomeFrameMainThread' tasks might get delayed for quite a while, depending on the system load. For tasks that need to do several things (e.g. reading from a file AND uploading something on the main thread), split them up into several tasks that depend on each other (or just let the first task start the next step once it is finished). There is no guarantee WHEN (within a frame) main thread tasks get executed. Most of them will get executed upon a 'FinishFrameTasks' call. However they are also run whenever the main thread needs to wait or cancel some other task and has nothing else to do. So tasks that get executed on the main thread should never assume a certain state of other systems.

Member Enumeration Documentation

Enumerator
EarlyThisFrame 

Highest priority, guaranteed to get finished in this frame.

ThisFrame 

Medium priority, guaranteed to get finished in this frame.

LateThisFrame 

Low priority, guaranteed to get finished in this frame.

EarlyNextFrame 

Highest priority in next frame, guaranteed to get finished this frame or the next.

NextFrame 

Medium priority in next frame, guaranteed to get finished this frame or the next.

LateNextFrame 

Low priority in next frame, guaranteed to get finished this frame or the next.

LongRunningHighPriority 

Tasks that might take a while, but should be preferred over 'LongRunning' tasks. Use this priority only rarely, otherwise 'LongRunning' tasks might never get executed.

LongRunning 

Use this priority for tasks that might run for a while.

FileAccessHighPriority 

For tasks that require file access (e.g. resource loading). They run on one dedicated thread, such that file accesses are done sequentially and never in parallel.

FileAccess 

For tasks that require file access (e.g. resource loading). They run on one dedicated thread, such that file accesses are done sequentially and never in parallel.

ThisFrameMainThread 

Tasks that need to be executed this frame, but in the main thread. This is mostly intended for resource creation.

SomeFrameMainThread 

Tasks that have no hard deadline but need to be executed in the main thread. This is mostly intended for resource creation.


The documentation for this struct was generated from the following file: