Skip to main content

Module pool

Module pool 

Source
Expand description

Minimal spin-waiting thread pool for low-latency parallel-for.

Workers spin on a generation counter while work is flowing, so dispatching a job costs about a microsecond. After a quiet period they back off to parking. A region ends as soon as every claimed block is done; a worker that never joined the region (e.g. because it was preempted) does not hold up the barrier.

Structs§

Pool
PoolOptions
Thread pool settings (see init_with).

Enums§

Qos
Scheduling class of compute threads. On Apple platforms this is the thread’s QoS class, which also picks the cores: Background threads run on the efficiency cores only, the other classes on any core (performance cores first). Elsewhere it is ignored.

Functions§

configure
Uses threads threads: installs a new global pool unless the current one has that many.
configure_with
Uses these settings: installs a new global pool unless the current one has them.
cpu_cores
Cores by kind: (performance, efficiency) physical cores (Apple: hw.perflevel0/1; other platforms report every logical core as a performance core).
get
init
Installs a global pool with threads threads (replacing any previous one).
init_with
Installs a global pool with the given settings (replacing any previous one). For phones, e.g. an iPhone’s 2 performance + 4 efficiency cores: threads: 6 uses all of them (work is claimed block by block, so slower cores take fewer blocks), threads: 2 only the performance cores, and efficiency_threads pins some workers to the efficiency cores.
options
The settings of the global pool.
run
threads