Ginger 1.1.5; VERSION ${PROJECT_VERSION}
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ginger::thread_pool Class Reference

#include <thread_pool.hpp>

Public Member Functions

 thread_pool (size_t num_threads=std::thread::hardware_concurrency())
 Construct a thread pool with the given number of worker threads.
 
 ~thread_pool ()
 
 thread_pool (const thread_pool &)=delete
 
thread_pooloperator= (const thread_pool &)=delete
 
template<typename F >
auto enqueue (F &&task) -> std::future< std::invoke_result_t< std::decay_t< F > > >
 

Constructor & Destructor Documentation

◆ thread_pool() [1/2]

ginger::thread_pool::thread_pool ( size_t  num_threads = std::thread::hardware_concurrency())
inlineexplicit

Construct a thread pool with the given number of worker threads.

Parameters
[in]num_threadsNumber of worker threads. Defaults to hardware concurrency (min 1).

◆ ~thread_pool()

ginger::thread_pool::~thread_pool ( )
inline

◆ thread_pool() [2/2]

ginger::thread_pool::thread_pool ( const thread_pool )
delete

Member Function Documentation

◆ enqueue()

template<typename F >
auto ginger::thread_pool::enqueue ( F &&  task) -> std::future<std::invoke_result_t<std::decay_t<F>>>
inline

Enqueue a callable for execution on the thread pool.

Template Parameters
FCallable type (invocable, returns T)
Parameters
taskCallable to execute
Returns
std::future<T> holding the result (or exception)

◆ operator=()

thread_pool & ginger::thread_pool::operator= ( const thread_pool )
delete

The documentation for this class was generated from the following file: