Skip to main content

Module pool

Module pool 

Source
Expand description

A pool of threads for the tools that play many slow tries (playtest, and later autobalance): every item of a work list run on one of n threads and timed, the answers given back in the list’s order, so what is made of them never depends on the thread count. The clock is the tools’; the core never reads one.

Functions§

cores
The threads to use when not told: one a core, or 1 if that’s unknown.
run
Runs run on every item of work on threads threads (at least one, and no more than there are items): thread w takes items w, w + threads, w + 2 × threads, …, and times each. The answers come back in work’s order with their times, or the first error in that order, whatever the thread count: once an item fails, no thread starts a later one, but the earlier ones all run. A panic in run is resumed here, on the calling thread.