Module thread_pool

Source
Expand description

Thread pool for running tasks on other threads.

ThreadPool implements a FIFO task queue where the tasks are executed on other threads, the amount of threads depending on how the ThreadPool is constructed. As a fallback, single-threaded platforms are supported by simply running the task in ThreadPool::join_task.

This module doesn’t do any allocation, and isn’t very usable on its own, it’s intended to be used alongside platform-provided threading functions, by the engine, to construct multithreading utilities.

Structs§

TaskHandle
Handle to a running or waiting task on a ThreadPool.
TaskInFlight
Packets sent between threads to coordinate a ThreadPool.
ThreadPool
Thread pool for running compute-intensive tasks in parallel.
ThreadState
State held by ThreadPool for sending and receiving TaskInFlights between it and a thread.

Type Aliases§

TaskChannel
Channel used by ThreadPool for communicating with the processing threads.
TaskReceiver
The receiving half of a TaskChannel.
TaskSender
The sending half of a TaskChannel.