BluFedora Job System v1.0.0
This is a C++ job system library for use in game engines.
Job::Task Struct Reference

Public Member Functions

 Task (WorkerID worker, TaskFn fn, TaskPtr parent) noexcept
 

Public Attributes

TaskFnStorage fn_storage
 The function that will be run. More...
 
AtomicInt32 num_unfinished_tasks
 The number of children tasks. More...
 
AtomicInt32 ref_count
 Keeps the task from being garbage collected. More...
 
TaskPtr parent
 The parent task, can be null. More...
 
AtomicTaskPtr first_continuation
 Head of linked list of tasks to be added on completion. More...
 
TaskPtr next_continuation
 Next element in the linked list of continuations. More...
 
WorkerID owning_worker
 The worker this task has been created on, needed for Task::toTaskPtr and various assertions. More...
 
QueueType q_type
 The queue type this task has been submitted to, initialized to k_InvalidQueueType. More...
 
std::uint8_t user_data_start
 Offset into padding that can be used for user data. More...
 
Byte user_data [k_TaskPaddingDataSize]
 User data storage. More...
 

Static Public Attributes

static constexpr std::size_t k_SizeOfMembers
 
static constexpr std::size_t k_TaskPaddingDataSize = k_ExpectedTaskSize - k_SizeOfMembers
 

Detailed Description

Definition at line 135 of file job_system.cpp.

Constructor & Destructor Documentation

◆ Task()

Task::Task ( WorkerID  worker,
TaskFn  fn,
TaskPtr  parent 
)
noexcept

Definition at line 1169 of file job_system.cpp.

1169 :
1170 fn_storage{fn},
1172 ref_count{1},
1173 parent{parent},
1174 first_continuation{nullptr},
1175 next_continuation{nullptr},
1177 q_type{k_InvalidQueueType}, /* Set to a valid value in 'Job::submitTask' */
1178 user_data_start{0},
1179 user_data{}
1180{
1181}
static constexpr QueueType k_InvalidQueueType
Definition: job_system.cpp:78
TaskFnStorage fn_storage
The function that will be run.
Definition: job_system.cpp:150
AtomicInt32 ref_count
Keeps the task from being garbage collected.
Definition: job_system.cpp:152
QueueType q_type
The queue type this task has been submitted to, initialized to k_InvalidQueueType.
Definition: job_system.cpp:157
TaskPtr next_continuation
Next element in the linked list of continuations.
Definition: job_system.cpp:155
AtomicInt32 num_unfinished_tasks
The number of children tasks.
Definition: job_system.cpp:151
WorkerID owning_worker
The worker this task has been created on, needed for Task::toTaskPtr and various assertions.
Definition: job_system.cpp:156
AtomicTaskPtr first_continuation
Head of linked list of tasks to be added on completion.
Definition: job_system.cpp:154
Byte user_data[k_TaskPaddingDataSize]
User data storage.
Definition: job_system.cpp:159
TaskPtr parent
The parent task, can be null.
Definition: job_system.cpp:153
std::uint8_t user_data_start
Offset into padding that can be used for user data.
Definition: job_system.cpp:158

Member Data Documentation

◆ k_SizeOfMembers

constexpr std::size_t Job::Task::k_SizeOfMembers
staticconstexpr
Initial value:
=
sizeof(TaskFnStorage) +
sizeof(AtomicInt32) +
sizeof(AtomicInt32) +
sizeof(std::uint8_t) +
sizeof(QueueType) +
sizeof(TaskPtr) +
sizeof(AtomicTaskPtr) +
sizeof(TaskPtr) +
sizeof(WorkerID)
std::atomic< TaskPtr > AtomicTaskPtr
Definition: job_system.cpp:115
std::atomic_int32_t AtomicInt32
Definition: job_system.cpp:86
QueueType
Determines which threads the task will be allowed to run on.
Definition: job_api.hpp:46
std::uint16_t WorkerID
The id type of each worker thread.
Definition: job_api.hpp:54

Definition at line 137 of file job_system.cpp.

◆ k_TaskPaddingDataSize

constexpr std::size_t Job::Task::k_TaskPaddingDataSize = k_ExpectedTaskSize - k_SizeOfMembers
staticconstexpr

Definition at line 148 of file job_system.cpp.

◆ fn_storage

TaskFnStorage Job::Task::fn_storage

The function that will be run.

Definition at line 150 of file job_system.cpp.

◆ num_unfinished_tasks

AtomicInt32 Job::Task::num_unfinished_tasks

The number of children tasks.

Definition at line 151 of file job_system.cpp.

◆ ref_count

AtomicInt32 Job::Task::ref_count

Keeps the task from being garbage collected.

Definition at line 152 of file job_system.cpp.

◆ parent

TaskPtr Job::Task::parent

The parent task, can be null.

Definition at line 153 of file job_system.cpp.

◆ first_continuation

AtomicTaskPtr Job::Task::first_continuation

Head of linked list of tasks to be added on completion.

Definition at line 154 of file job_system.cpp.

◆ next_continuation

TaskPtr Job::Task::next_continuation

Next element in the linked list of continuations.

Definition at line 155 of file job_system.cpp.

◆ owning_worker

WorkerID Job::Task::owning_worker

The worker this task has been created on, needed for Task::toTaskPtr and various assertions.

Definition at line 156 of file job_system.cpp.

◆ q_type

QueueType Job::Task::q_type

The queue type this task has been submitted to, initialized to k_InvalidQueueType.

Definition at line 157 of file job_system.cpp.

◆ user_data_start

std::uint8_t Job::Task::user_data_start

Offset into padding that can be used for user data.

Definition at line 158 of file job_system.cpp.

◆ user_data

Byte Job::Task::user_data[k_TaskPaddingDataSize]

User data storage.

Definition at line 159 of file job_system.cpp.


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