Expand description
Where background work runs: a Pool of worker threads, and the
TaskGroups of its tasks that an owner waits for.
A pool’s tasks queue in lanes: the pool’s own, and one per group. Its
workers take one task from each lane with work in turn, so a lane with
many tasks queued doesn’t hold back the tasks of the others. A serial
group’s lane (TaskGroup::serial) runs one task at a time, in order.
A pool without threads (Pool::local) is for a host with one thread,
the browser: its tasks run when that thread calls Pool::run_until.
Structs§
- Pool
- Runs background work on worker threads, or, without threads, on the
thread that runs it. Cheap to clone: clones share the pool. A worker
starts when a task arrives while every running worker is busy, up to the
pool’s thread count, so a pool that runs nothing starts no threads. Its
threads end once the last clone and the last
TaskGroupof it drop, or once it’sshut_down, dropping the tasks still queued. - Task
Group - A lane of tasks of one pool, which an owner waits for with
wait. Cheap to clone: clones share the lane. Dropping it leaves its queued tasks to run.
Type Aliases§
- Panic
Handler - What a pool calls with the message of a task’s panic.
- Respond
- Where a job hands its result: called at most once, from any thread, while the job runs or later. Dropping it uncalled drops the result.
- Task
- A task that runs on a pool.
- Waker
- What a pool calls when work arrives while it had none.