Library / Concurrency / Worker pools / WorkerPool
WorkerPool
V1 Part H.4.1: a pool of worker threads that run submitted jobs.
Constructors 1
INIT(int32 workerCount, int32 capacity, BackpressurePolicy policy)
Methods 4
MODIFY METHOD submit(TaskStarter job) RETURNS STATUSmodifies
Enqueue a job for a worker to run. Pipe-XOR STATUS. The bare-named (owning) form consumes the source — the pool takes ownership of the job. At queue capacity, behaviour follows the BackpressurePolicy fixed at construction. Returns FAILURE if the pool has been shut down.
MODIFY METHOD awaitIdle() RETURNS voidmodifies
Block until the pool is idle — the queue is empty and no job is running. Does not stop the pool; the workers stay alive for more work. Useful as a batch barrier between submit waves.
MODIFY METHOD shutdown() RETURNS voidmodifies
Sticky shutdown. Queued-but-unstarted jobs still drain; once the queue empties, every worker leaves its loop and this returns. Idempotent — a second call is a no-op.
METHOD size() RETURNS int64reads
Number of worker threads in this pool.