|
|
PixelBullet
0.0.1
A C++ game engine
|
A fixed-size pool of threads. More...
#include <ThreadPool.hpp>
Public Member Functions | |
| ThreadPool (uint32_t threadCount=std::thread::hardware_concurrency()) | |
| Constructs the pool with the given number of threads. Defaults to the hardware concurrency. | |
| ~ThreadPool () | |
| Waits for all tasks to complete and then stops the pool. | |
| template<typename F , typename... Args> | |
| auto | Enqueue (F &&f, Args &&... args) |
| Enqueues a task to be executed by the thread pool. | |
| void | Wait () |
| Waits until the task queue is empty. | |
| const std::vector< std::thread > & | GetWorkers () const |
| Returns the worker threads. | |
A fixed-size pool of threads.
|
explicit |
Constructs the pool with the given number of threads. Defaults to the hardware concurrency.
| PixelBullet::ThreadPool::~ThreadPool | ( | ) |
Waits for all tasks to complete and then stops the pool.
| auto PixelBullet::ThreadPool::Enqueue | ( | F && | f, |
| Args &&... | args ) |
Enqueues a task to be executed by the thread pool.
|
inline |
Returns the worker threads.
| void PixelBullet::ThreadPool::Wait | ( | ) |
Waits until the task queue is empty.