Nana C++ Library. Reference for users.
What we need to use nana
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
nana::threads::pool Class Reference

A thread pool manages a group threads for a large number of tasks processing. More...

Classes

class  impl
 
struct  task_signal
 

Public Member Functions

 pool (unsigned thread_number=std::thread::hardware_concurrency())
 Creates a group of threads. More...
 
 pool (pool &&)
 
 ~pool ()
 waits for the all running tasks till they are finished and skips all the queued tasks. More...
 
pooloperator= (pool &&)
 
template<typename Function >
void push (const Function &f)
 
void signal ()
 Make a signal that will be triggered when the tasks which are pushed before it are finished. More...
 
void wait_for_signal ()
 Waits for a signal until the signal processed. More...
 
void wait_for_finished ()
 

Detailed Description

A thread pool manages a group threads for a large number of tasks processing.

Examples:
audio_player.cpp, thread-pool.cpp, and threading.cpp.

Constructor & Destructor Documentation

nana::threads::pool::pool ( unsigned  thread_number = std::thread::hardware_concurrency())

Creates a group of threads.

nana::threads::pool::pool ( pool &&  other)
nana::threads::pool::~pool ( )

waits for the all running tasks till they are finished and skips all the queued tasks.

Member Function Documentation

pool & nana::threads::pool::operator= ( pool &&  other)
template<typename Function >
void nana::threads::pool::push ( const Function &  f)
inline
Examples:
thread-pool.cpp.
void nana::threads::pool::signal ( )

Make a signal that will be triggered when the tasks which are pushed before it are finished.

Examples:
thread-pool.cpp.
void nana::threads::pool::wait_for_finished ( )
void nana::threads::pool::wait_for_signal ( )

Waits for a signal until the signal processed.

Examples:
thread-pool.cpp.