Thread pool utility class.
More...
#include <threadPool.hpp>
|
| ThreadPool (unsigned int maxThreads=0) |
|
virtual | ~ThreadPool () |
|
void | start () |
|
void | stop () |
|
template<typename Func , typename... Args> |
void | add (Func function, Args...args) |
|
Thread pool utility class.
Number of thread can be parameterized in constructor. If not set, the maximum number of thread will be equal to the number of processor or 1.
Every thread which will be run by this way will be detach. They will be not joinable.
Thread can be retrieve through event mechanism or by specific implementation in thread function.
- Author
- Vincent Lachenal
- Since
- 0.1
anch::ThreadPool::ThreadPool |
( |
unsigned int |
maxThreads = 0 | ) |
|
|
inline |
ThreadPool constructor
- Parameters
-
maxThreads | the maximum number of alive threads (default number of processor or 1 if not defined) |
virtual anch::ThreadPool::~ThreadPool |
( |
| ) |
|
|
inlinevirtual |
template<typename Func , typename... Args>
void anch::ThreadPool::add |
( |
Func |
function, |
|
|
Args... |
args |
|
) |
| |
|
inline |
Add a new thread in queue
- Parameters
-
function | the function which will be call in a separated thread |
args | the function arguments |
void anch::ThreadPool::start |
( |
| ) |
|
|
inline |
Start executing threads in queue
void anch::ThreadPool::stop |
( |
| ) |
|
|
inline |
Stop executing threads in queue
The documentation for this class was generated from the following file: