ThreadPool Class Reference
#include <ThreadPool.h>
Public Member Functions | |
ThreadPool (size_t=0) | |
template<class F , class... Args> | |
auto | enqueue (F &&f, Args &&... args) -> std::future< typename std::invoke_result< F, Args... >::type > |
size_t | workerCount () const |
~ThreadPool () | |
Private Attributes | |
std::vector< std::thread > | workers |
std::queue< std::function< void()> > | tasks |
std::mutex | queue_mutex |
std::condition_variable | condition |
bool | stop |
Constructor & Destructor Documentation
◆ ThreadPool()
|
inline |
◆ ~ThreadPool()
|
inline |
Member Function Documentation
◆ enqueue()
template<class F , class... Args>
auto ThreadPool::enqueue | ( | F && | f, |
Args &&... | args | ||
) | -> std::future<typename std::invoke_result<F,Args...>::type> |
◆ workerCount()
|
inline |
Member Data Documentation
◆ condition
|
private |
◆ queue_mutex
|
private |
◆ stop
|
private |
◆ tasks
|
private |
◆ workers
|
private |