This snippet illustrates how to use thread pool. The simple thread pool concept implementation.
// Creation a thread pool. // Maximum count of threads in the pool is 10 and initially will be created is 3 auxutils::ept::ThreadPool* poPool = new auxutils::ept::ThreadPool ( 10 , 3 ); // Creation task id auxutils::ept::ThreadPool::TaskId myTaskId = poPool->createTaskId(); MyClass oMyClass; // Scheduling the user task function in user class (boost::bind usage) // All scheduled tasks per task id can't run simultaneously poPool->schedule ( myTaskId, boost::bind ( &MyClass::myTaskHandler, &oMyClass) ); // Canceling all scheduled jobs by id poPool->cancel ( myTaskId ); // Wait for finish scheduled jobs by id poPool->wait ( myTaskId ); // Delete pool delete poPool;