Skip to main content

Module worker

Module worker 

Source
Expand description

Per-worker state for the multi-threaded executor.

Each worker thread owns a StealableQueue and runs a run_worker loop:

run_worker(id, shared_state)
  ├─ check own StealableQueue (local, fast path)
  ├─ check GlobalQueue (cross-thread injection)
  ├─ steal from random victim in WorkStealingPool
  └─ park on reactor (I/O + timer deadline)

Worker 0 is always the main thread (drives the root future). Workers 1..N are spawned background threads.