A reusable worker slot.
Caller-owned, one per concurrent task. Each slot owns one scratch arena, created lazily and cleared at the end of every task. A slot must not be respawned while still running. It runs either a single-shot fn or a sliced task (exactly one is set).
- Parameters
-
| thread | The worker thread. |
| scratch | Private temp arena; cleared each task, reused on respawn. |
| running | Cleared when the task finishes or is stopped. |
| pause | Pauses a sliced task between slices. |
| detached | Whether the worker is fire-and-forget. |
| fn | The active single-shot body, or null. |
| task | The active sliced body, or null. |
| userdata | The active task context. |
| pause_mtx | Guards the pause wait. |
| pause_cnd | Signalled on resume/stop. |
| primitives_init | Whether the primitives have been initialized. |