#include <threadpool.hpp>
|
| | threadpool (size_t threads=std::thread::hardware_concurrency()) |
| | constructs a new threadpool
|
| |
| | ~threadpool () |
| | destroys threadpool after calling shutdown if necessary
|
| |
| template<class F , class... Args> |
| std::future< std::result_of_t< F(Args...)> > | submit (F &&function, Args &&...args) |
| | submits a function with its arguments to the threadpool
|
| |
| bool | active () const |
| | check if the threadpool is active
|
| |
| void | shutdown () |
| | shut down threadpool by joining threads and rejecting submissions
|
| |
◆ threadpool()
| maxtek::threadpool::threadpool |
( |
size_t | threads = std::thread::hardware_concurrency() | ) |
|
|
inline |
constructs a new threadpool
- Parameters
-
| threads | number of threads to use for constructing the threadpool |
- Exceptions
-
| std::runtime_error | if threads is set to zero |
◆ ~threadpool()
| maxtek::threadpool::~threadpool |
( |
| ) |
|
|
inline |
destroys threadpool after calling shutdown if necessary
◆ active()
| bool maxtek::threadpool::active |
( |
| ) |
const |
|
inline |
check if the threadpool is active
- Returns
- true if the threadpool is active, false if it has been shut down
◆ shutdown()
| void maxtek::threadpool::shutdown |
( |
| ) |
|
|
inline |
shut down threadpool by joining threads and rejecting submissions
- Exceptions
-
| std::runtime_error | if the thread pool has already been shut down |
◆ submit()
template<class F , class... Args>
| std::future< std::result_of_t< F(Args...)> > maxtek::threadpool::submit |
( |
F && | function, |
|
|
Args &&... | args ) |
|
inline |
submits a function with its arguments to the threadpool
- Template Parameters
-
| F | function signature |
| Args | function argument types |
- Parameters
-
| function | function signature |
| args | arguments to pass to the function |
- Returns
- a future holding the asynchronous function result
- Exceptions
-
| std::runtime_error | if the thread pool has been shut down |
The documentation for this class was generated from the following file: