Expand description
A pool of worker threads that lives as long as the backend, from spec/10-cpu.md.
Pool::run hands out tasks 0..n through a shared counter to the calling thread and every
worker, and returns when all of them are done. Between jobs a worker spins for a while, since
the next op of a plan is usually microseconds away, and then sleeps on a condition variable so
an idle server costs nothing. A job is a borrowed closure, so running one allocates nothing.
Which thread runs a task depends on timing, but what a task computes does not, and that is what keeps results independent of the thread count.
Structsยง
- Pool
- Worker threads, created once.