Skip to content

Engine → Core

job_system.h

Declarations for job_system.h.

Structs

File Description
jobs::job_system_desc Configuration passed to job_system::start().
jobs::job_system_stats Counters accumulated since the last start(). Reads are approximate while jobs are running. stolen + helped + inlineExecutions == executed holds only while no worker executes a job it queued itself: such a job is neither stolen nor helped and is counted in executed alone.

Classes

File Description
jobs::job_system Thread pool with a shared, priority-laned job queue. Jobs are std::function objects; a system started with zero workers (or one that is not running) executes everything inline on the calling thread, which keeps every caller deterministic and headless-testable. wait() executes queued jobs on the waiting thread, so waiting from inside a job never deadlocks. Not copyable or movable: workers hold the address of the system.

Enumerations

jobs::job_priority

enum class job_priority : u8 {
    HIGH = 0,
    NORMAL,
    LOW
};

Scheduling lane. Workers always take the highest priority job available.

Type Aliases

jobs::detail::range_invoke_fn

using range_invoke_fn = void (*)(const void *context, usize begin, usize end);

Executes one parallel_for range against an opaque body. Lets both parallel_for overloads share one allocation-free dispatch path.

Forward Declarations

jobs::job_system::state

class state;

Constants

Name Type Value Description
jobs::JOB_PRIORITY_COUNT inline constexpr usize 3 Number of priority lanes.
jobs::MAX_QUEUED_JOBS inline constexpr usize usize{1} << 20 Upper bound accepted for job_system_desc::maxQueuedJobs. start() reserves one pointer per slot in each priority lane (24 bytes per unit), so the bound keeps a stray value from exhausting memory.
jobs::MAX_WORKER_COUNT inline constexpr u32 256 Upper bound accepted for job_system_desc::workerCount.