27 for (
unsigned int i = 0; i < n; ++i)
55 auto job =
jobs_.front();
61 if (!job->isCancled())
bool isCancled() const
Checks if this job has been cancled.
bool canceled
Whether the job is cancled or not.
void cancel()
Cancels this job.
std::mutex mutex_
Job queue mutex.
unsigned int getThreadCount() const
Get the number of threads.
bool active_
Is thread pool active?
~Pool()
Destructor. Cancels all threads and joins them.
Pool(unsigned int n=std::thread::hardware_concurrency())
Constructor.
std::condition_variable cv_
Job queue condition variable.
std::vector< std::thread > threads_
Threads.
void run()
Background thread process. Executes jobs submitted from submit().
std::queue< std::shared_ptr< Joblet > > jobs_
Jobs to execute.
T emplace_back(T... args)
Main namespace. Contains all library classes and functions.