Class thread_pool
Defined in File thread_pool.hpp
Class Documentation
-
class thread_pool
A threadsafe singleton thread pool class based on std::thread.
Public Functions
-
void set_num_threads_internal(const int)
Set the number of threads to be maintained in the pool.
-
int get_num_threads_internal()
Retrieve the number of threads to be maintained in the pool.
-
template<class Function, class ...Args, typename result_type = std::invoke_result_t<std::decay_t<Function>, std::decay_t<Args>...>>
inline std::enable_if<notstd::is_void<result_type>::value, std::future<result_type>>::type internal_submit(Function &&f, Args&&... args) Send a function with a return type to the thread pool for execution.
-
template<class Function, class ...Args, typename result_type = std::invoke_result_t<std::decay_t<Function>, std::decay_t<Args>...>>
inline std::enable_if<std::is_void<result_type>::value, void>::type internal_submit(Function &&f, Args&&... args) Send a function with no return value to the thread pool for execution.
-
thread_pool(const thread_pool&) = delete
Uncopyable.
-
thread_pool &operator=(const thread_pool&) = delete
Unassignable.
Public Static Functions
-
static void set_num_threads(const int)
Public interface for setting the number of threads to be maintained in the pool.
-
static int get_num_threads()
Public interface for retrieving the number of threads to be maintained in the pool.
-
template<class Function, class ...Args, typename result_type = std::invoke_result_t<std::decay_t<Function>, std::decay_t<Args>...>>
static inline std::enable_if<notstd::is_void<result_type>::value, std::future<result_type>>::type submit(Function &&f, Args&&... args) Public interface for sending a function with a return type to the thread pool for execution.
-
template<class Function, class ...Args, typename result_type = std::invoke_result_t<std::decay_t<Function>, std::decay_t<Args>...>>
static inline std::enable_if<std::is_void<result_type>::value, void>::type submit(Function &&f, Args&&... args) Public interface for sending a function with no return type to the thread pool for execution.
-
void set_num_threads_internal(const int)