17 #ifndef THREADPOOL_HPP_
18 #define THREADPOOL_HPP_
50 void waitForWorkersShutdown();
62 std::list<std::thread> workers_;
63 std::size_t workerCount_ = 0;
65 std::list<ThreadPoolTask> tasks_;
67 KAA_MUTEX_DECLARE(threadPoolGuard_);
static const std::size_t DEFAULT_WORKER_NUMBER
#define KAA_CONDITION_VARIABLE
virtual void add(const ThreadPoolTask &task)
Add a task for execution.
virtual void awaitTermination(std::size_t seconds)
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs...
virtual void shutdownNow()
Initiates a shutdown in which all executing tasks will complete. Pending tasks will be declined...
ThreadPool(std::size_t workerCount=DEFAULT_WORKER_NUMBER)
std::function< void()> ThreadPoolTask
virtual void shutdown()
Initiates a shutdown in which previously added tasks are executed, but no new tasks will be accepted...