AnCH Framework  0.1
Another C++ Hack Framework
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.

Vincent Lachenal

Constructor & Destructor Documentation

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

ThreadPool constructor

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

ThreadPool destructor

Member Function Documentation

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

Add a new thread in queue

functionthe function which will be call in a separated thread
argsthe function arguments
void anch::ThreadPool::start ( )

Start executing threads in queue

void anch::ThreadPool::stop ( )

Stop executing threads in queue

The documentation for this class was generated from the following file: