![]() |
General Utility Library for C++17 25.4.1
|
A thread pool and task queue.
Classes | |
class | gul17::ThreadPool |
A pool of worker threads with a task queue. More... | |
Enumerations | |
enum class | gul17::TaskState { gul17::TaskState::pending , gul17::TaskState::running , gul17::TaskState::complete , gul17::TaskState::canceled } |
An enum describing the state of an individual task. More... | |
Functions | |
std::shared_ptr< ThreadPool > | gul17::make_thread_pool (std::size_t num_threads, std::size_t capacity=ThreadPool::default_capacity) |
Create a thread pool with the desired number of threads and the specified capacity for queuing tasks. | |
|
strong |
|
inline |
Create a thread pool with the desired number of threads and the specified capacity for queuing tasks.
The thread pool is allocated in a shared pointer, which is necessary so that task handles can access the pool safely. A ThreadPool cannot be constructed directly.
References gul17::bit_set(), gul17::ThreadPool::capacity(), and gul17::ThreadPool::make_shared().