An implementation of Thread pool.
More...
#include <ThreadPool.h>
An implementation of Thread pool.
- Copyright
- zlib license
- Authors
- Jakob Progsch, Václav Zeman
◆ ThreadPool()
Utils::ThreadPool::ThreadPool |
( |
| ) |
|
|
default |
◆ ~ThreadPool()
Utils::ThreadPool::~ThreadPool |
( |
| ) |
|
|
inline |
◆ add_task()
auto Utils::ThreadPool::add_task |
( |
F && |
f, |
|
|
Args &&... |
args |
|
) |
| -> std::future<typename std::result_of<F(Args...)>::type> |
Add a task to the thread.
- Parameters
-
f | An object f |
args | A list of arguments |
- Returns
- A future object
◆ add_thread()
void Utils::ThreadPool::add_thread |
( |
std::function< void()> |
initializer | ) |
|
|
inline |
Add an extra thread.
- Parameters
-
initializer | An initializer called before doing anything so that user can initialize per-thread data structures |
◆ initialize()
void Utils::ThreadPool::initialize |
( |
std::size_t |
| ) |
|
|
inline |
Create worker threads.
- Parameters
-
threads | (Optional) The number of threads |
The documentation for this class was generated from the following file: