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
- Pool
Options - 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:
Backgroundthreads run on the efficiency cores only, the other classes on any core (performance cores first). Elsewhere it is ignored.
Functions§
- configure
- Uses
threadsthreads: 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
threadsthreads (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: 6uses all of them (work is claimed block by block, so slower cores take fewer blocks),threads: 2only the performance cores, andefficiency_threadspins some workers to the efficiency cores. - options
- The settings of the global pool.
- run
- threads