Pool of worker threads. This class offers a simple pool of worker threads.
More...
#include <worker_pool.h>
|
| worker_pool (int num_threads) noexcept |
| Creates a worker pool with a number of threads. More...
|
|
| ~worker_pool () noexcept |
| Destructs the worker pool after joining with all threads in the pool. More...
|
|
| worker_pool (worker_pool &&) noexcept=default |
|
worker_pool & | operator= (worker_pool &&) noexcept=default |
|
template<typename E , typename F , typename ... Args> |
void | launch (const E &ex, F f, Args &&... args) |
| Launch a function in the pool. More...
|
|
template<typename E , typename F , typename ... Args> |
void | launch_tasks (const E &ex, F &&f, Args &&... args) |
|
void | wait () noexcept |
| Wait until all launched tasks have been completed. More...
|
|
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.
◆ worker_pool() [1/2]
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. |
◆ ~worker_pool()
grppi::worker_pool::~worker_pool |
( |
| ) |
|
|
inlinenoexcept |
Destructs the worker pool after joining with all threads in the pool.
◆ worker_pool() [2/2]
◆ launch()
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. |
◆ launch_tasks()
template<typename E , typename F , typename ... Args>
void grppi::worker_pool::launch_tasks |
( |
const E & |
ex, |
|
|
F && |
f, |
|
|
Args &&... |
args |
|
) |
| |
|
inline |
◆ operator=()
◆ wait()
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: