Expand description
A small persistent thread pool owned by the ExecutionScheduler.
The scheduler runs a concurrent wave’s AgentAccess::Isolated agents as
independent jobs. Rather than re-spawn threads with std::thread::scope
every wave, this pool spawns its workers once (in
ExecutionScheduler::new) and reuses them for the life of the scheduler,
amortising the spawn cost as waves grow.
The jobs it runs are 'static: an Isolated agent touches no World and
reaches its per-frame inputs through an Arc<LaneBus> + Arc<Runtime> and
its own Arc<Mutex<dyn Agent>>, all of which are owned/Send. Nothing
borrowed from the frame stack crosses onto a worker — the scheduler’s lone
SharedWorld agent (which reads &World) runs inline on the calling thread
instead — so this needs no unsafe and no lifetime transmute.
§RULES §5
This is the third named exception to the “no std::thread::spawn” rule (the
DCC tick thread and the scheduler’s scoped executor are the other two): a
scheduler-owned pool, spawned once and joined on Drop. It never spawns
per frame and its threads never outlive the scheduler.
Structs§
- Worker
Pool - A fixed-size pool of persistent worker threads.