suanPan
Loading...
Searching...
No Matches
thread_pool Class Reference

#include <thread_pool.hpp>

Collaboration diagram for thread_pool:

Public Member Functions

 thread_pool (const concurrency_t thread_count_=std::thread::hardware_concurrency())
 
 ~thread_pool ()
 
size_t get_tasks_queued () const
 
size_t get_tasks_running () const
 
size_t get_tasks_total () const
 
concurrency_t get_thread_count () const
 
template<typename F , typename... A>
void push_task (const F &task, const A &... args)
 
void reset (const concurrency_t thread_count_=std::thread::hardware_concurrency())
 
template<typename F , typename... A, typename R = std::invoke_result_t<std::decay_t<F>, std::decay_t<A>...>>
std::future< R > submit (const F &task, const A &... args)
 
void wait_for_tasks ()
 

Public Attributes

std::atomic< bool > paused = false
 

Constructor & Destructor Documentation

◆ thread_pool()

thread_pool::thread_pool ( const concurrency_t  thread_count_ = std::thread::hardware_concurrency())
inlineexplicit

◆ ~thread_pool()

thread_pool::~thread_pool ( )
inline
Here is the call graph for this function:

Member Function Documentation

◆ get_tasks_queued()

size_t thread_pool::get_tasks_queued ( ) const
inline

◆ get_tasks_running()

size_t thread_pool::get_tasks_running ( ) const
inline

◆ get_tasks_total()

size_t thread_pool::get_tasks_total ( ) const
inline

◆ get_thread_count()

concurrency_t thread_pool::get_thread_count ( ) const
inline

◆ push_task()

template<typename F , typename... A>
void thread_pool::push_task ( const F &  task,
const A &...  args 
)
inline
Here is the caller graph for this function:

◆ reset()

void thread_pool::reset ( const concurrency_t  thread_count_ = std::thread::hardware_concurrency())
inline
Here is the call graph for this function:

◆ submit()

template<typename F , typename... A, typename R = std::invoke_result_t<std::decay_t<F>, std::decay_t<A>...>>
std::future< R > thread_pool::submit ( const F &  task,
const A &...  args 
)
inline
Here is the call graph for this function:

◆ wait_for_tasks()

void thread_pool::wait_for_tasks ( )
inline
Here is the caller graph for this function:

Member Data Documentation

◆ paused

std::atomic<bool> thread_pool::paused = false

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