Skip to main content

Module task

Module task 

Source
Expand description

A fixed-size job pool for off-thread work.

Used for the jobs that are naturally owned and independent: asset import, chunk streaming, navmesh bake, atlas packing. Jobs are 'static (they own their inputs and return their output); for work that must borrow a local slice, use std::thread::scope directly — this pool is not a scoped pool.

Quality-of-life matched to the reference task pools (bevy_tasks, Godot’s WorkerThreadPool): a worker that panics carries the panic to the joiner rather than poisoning the queue or silently dropping the job, and the pool joins its workers on drop.

Determinism: a job pool introduces scheduling nondeterminism by nature. Never let a sim outcome depend on the order in which jobs finish; collect results and apply them in a fixed order (or in a Sim schedule that reads a completed queue) if the result feeds gameplay.

Structs§

Task
A handle to a job running on a TaskPool.
TaskPool
Fixed-size worker pool. new(n) starts n worker threads.