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 (const char *const name, const job::internal::JobFn job_fn, job::Counter *const counter) noexcept
 

Public Attributes

const char * name
 Debug name of this task. More...
 
internal::JobFn job_fn
 The function that will be run. More...
 
Countercounter
 The counter to be decremented. More...
 
std::uint8_t userdata_align
 Alignment offset needed by userdata. More...
 
std::atomic_bool is_ready_for_gc
 Set to true when the task can be reused. 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 117 of file job_system.cpp.

Constructor & Destructor Documentation

◆ Task()

job::Task::Task ( const char *const  name,
const job::internal::JobFn  job_fn,
job::Counter *const  counter 
)
inlinenoexcept

Definition at line 135 of file job_system.cpp.

135 :
136 name{name},
137 job_fn{job_fn},
139 is_ready_for_gc{false},
141 user_data{}
142 {
143 counter->unfinished_tasks.fetch_add(1u, std::memory_order_release);
144 }
std::atomic_uint64_t unfinished_tasks
Definition: job_api.hpp:50
std::uint8_t userdata_align
Alignment offset needed by userdata.
Definition: job_system.cpp:131
Byte user_data[k_TaskPaddingDataSize]
User data storage.
Definition: job_system.cpp:133
Counter * counter
The counter to be decremented.
Definition: job_system.cpp:130
const char * name
Debug name of this task.
Definition: job_system.cpp:128
std::atomic_bool is_ready_for_gc
Set to true when the task can be reused.
Definition: job_system.cpp:132
internal::JobFn job_fn
The function that will be run.
Definition: job_system.cpp:129

Member Data Documentation

◆ k_SizeOfMembers

constexpr std::size_t job::Task::k_SizeOfMembers
staticconstexpr
Initial value:
=
sizeof(const char*) +
sizeof(internal::JobFn) +
sizeof(Counter*) +
sizeof(std::uint8_t) +
sizeof(std::atomic_bool)
void(*)(const PrivateCtx &ctx) JobFn
Definition: job_api.hpp:234

Definition at line 119 of file job_system.cpp.

◆ k_TaskPaddingDataSize

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

Definition at line 126 of file job_system.cpp.

◆ name

const char* job::Task::name

Debug name of this task.

Definition at line 128 of file job_system.cpp.

◆ job_fn

internal::JobFn job::Task::job_fn

The function that will be run.

Definition at line 129 of file job_system.cpp.

◆ counter

Counter* job::Task::counter

The counter to be decremented.

Definition at line 130 of file job_system.cpp.

◆ userdata_align

std::uint8_t job::Task::userdata_align

Alignment offset needed by userdata.

Definition at line 131 of file job_system.cpp.

◆ is_ready_for_gc

std::atomic_bool job::Task::is_ready_for_gc

Set to true when the task can be reused.

Definition at line 132 of file job_system.cpp.

◆ user_data

Byte job::Task::user_data[k_TaskPaddingDataSize]

User data storage.

Definition at line 133 of file job_system.cpp.


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