General Utility Library for C++14  2.11
Classes | Namespaces | Enumerations | Functions
ThreadPool.h File Reference

Detailed Description

Declaration of the ThreadPool class.

General Utility Library Contributors
Created on November 6, 2018

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the license, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see

#include <chrono>
#include <condition_variable>
#include <functional>
#include <future>
#include <memory>
#include <mutex>
#include <stdexcept>
#include <thread>
#include <vector>
#include <gul14/cat.h>
#include <gul14/traits.h>
Include dependency graph for ThreadPool.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


class  gul14::ThreadPool
 A pool of worker threads with a task queue. More...
class  gul14::ThreadPool::TaskHandle< T >
 A handle for a task that has (or had) been enqueued on a ThreadPool. More...


 Namespace gul14 contains all functions and classes of the General Utility Library.


enum class  gul14::TaskState { gul14::pending , gul14::running , gul14::complete , gul14::canceled }
 An enum describing the state of an individual task. More...


GUL_EXPORT std::shared_ptr< ThreadPool > gul14::detail::lock_pool_or_throw (std::weak_ptr< ThreadPool > pool)
std::shared_ptr< ThreadPool > gul14::make_thread_pool (std::size_t num_threads, std::size_t capacity=ThreadPool::default_capacity)
 Create a thread pool with the desired number of threads and the specified capacity for queuing tasks. More...