XNetwork 1.7.5; VERSION ${PROJECT_VERSION}
Loading...
Searching...
No Matches
Public Member Functions | List of all members
xnetwork::thread_pool Class Reference

#include <thread_pool.hpp>

Public Member Functions

 thread_pool (size_t num_threads=std::thread::hardware_concurrency())
 
 ~thread_pool ()
 
 thread_pool (const thread_pool &)=delete
 
thread_pooloperator= (const thread_pool &)=delete
 
 thread_pool (thread_pool &&)=delete
 
thread_pooloperator= (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/3]

xnetwork::thread_pool::thread_pool ( size_t  num_threads = std::thread::hardware_concurrency())
inlineexplicit
Parameters
num_threadsNumber of worker threads. Defaults to hardware concurrency (min 1).

◆ ~thread_pool()

xnetwork::thread_pool::~thread_pool ( )
inline

◆ thread_pool() [2/3]

xnetwork::thread_pool::thread_pool ( const thread_pool )
delete

◆ thread_pool() [3/3]

xnetwork::thread_pool::thread_pool ( thread_pool &&  )
delete

Member Function Documentation

◆ enqueue()

template<typename F >
auto xnetwork::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=() [1/2]

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

◆ operator=() [2/2]

thread_pool & xnetwork::thread_pool::operator= ( thread_pool &&  )
delete

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