AnCH Framework  0.1
Another C++ Hack Framework
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
anch::ThreadPool Class Reference

Thread pool utility class. More...

#include <threadPool.hpp>

Collaboration diagram for anch::ThreadPool:

Public Member Functions

 ThreadPool (unsigned int maxThreads=0)
 
virtual ~ThreadPool ()
 
void start ()
 
void stop ()
 
template<typename Func , typename... Args>
void add (Func function, Args...args)
 

Detailed Description

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

Constructor & Destructor Documentation

anch::ThreadPool::ThreadPool ( unsigned int  maxThreads = 0)
inline

ThreadPool constructor

Parameters
maxThreadsthe maximum number of alive threads (default number of processor or 1 if not defined)
virtual anch::ThreadPool::~ThreadPool ( )
inlinevirtual

ThreadPool destructor

Member Function Documentation

template<typename Func , typename... Args>
void anch::ThreadPool::add ( Func  function,
Args...  args 
)
inline

Add a new thread in queue

Parameters
functionthe function which will be call in a separated thread
argsthe 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: