Class ThreadPool

Class Documentation

class ThreadPool

The thread pool is configured with a number of threads and accepts lambdas as functions to run in one of the threads in the pool.

Public Functions

ThreadPool()
explicit ThreadPool(int thread_num)
ThreadPool(int thread_num, int queue_size)
ThreadPool(const ThreadPool&) = delete
ThreadPool(ThreadPool&&) = delete
ThreadPool &operator=(const ThreadPool&) = delete
ThreadPool &operator=(ThreadPool&&) = delete
~ThreadPool()
int getSize() const
int getIdle() const
std::thread &getThread(int i)
void resize(int thread_num)
void clearQueue()
std::function<void(int)> pop()
void stop(bool wait = false)
template<typename F, typename ...Rest>
inline auto push(F &&f, Rest&&... rest) -> std::future<decltype(f(0, rest...))>
template<typename F>
inline auto push(F &&f) -> std::future<decltype(f(0))>