Pool of worker threads. This class offers a simple pool of worker threads.
More...
#include <worker_pool.h>
Pool of worker threads. This class offers a simple pool of worker threads.
- Note
- Current version does not support more threads than the initially set number of threads.
grppi::worker_pool::worker_pool |
( |
int |
num_threads | ) |
|
|
inlinenoexcept |
Creates a worker pool with a number of threads.
- Parameters
-
num_threads | Number of threads for the pool. |
grppi::worker_pool::~worker_pool |
( |
| ) |
|
|
inlinenoexcept |
Destructs the worker pool after joining with all threads in the pool.
template<typename E , typename F , typename... Args>
void grppi::worker_pool::launch |
( |
const E & |
ex, |
|
|
F |
f, |
|
|
Args &&... |
args |
|
) |
| |
|
inline |
Launch a function in the pool.
- Template Parameters
-
E | Execution policy type. |
F | Type for launched function. |
Args | Type for launched function arguments. |
- Parameters
-
ex | Execution policy. |
f | Function to be launched. |
args | Arguments for launched function. |
template<typename E , typename F , typename... Args>
void grppi::worker_pool::launch_tasks |
( |
const E & |
ex, |
|
|
F && |
f, |
|
|
Args &&... |
args |
|
) |
| |
|
inline |
void grppi::worker_pool::wait |
( |
| ) |
|
|
inlinenoexcept |
Wait until all launched tasks have been completed.
- Postcondition
- Number of workers is 0.
The documentation for this class was generated from the following file: