join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::ThreadPool Class Reference

thread pool class. More...

#include <threadpool.hpp>

Public Member Functions

 ThreadPool (int workers=std::max(int(std::thread::hardware_concurrency()), 1))
 create thread pool.
 
 ~ThreadPool ()
 destroy thread pool.
 
template<class Function , class... Args>
void push (Function &&func, Args &&... args)
 push a job to the work queue.
 
size_t size ()
 return thread pool size.
 

Friends

class WorkerThread
 friendship with worker thread.
 

Detailed Description

thread pool class.

Constructor & Destructor Documentation

◆ ThreadPool()

ThreadPool::ThreadPool ( int workers = std::max (int (std::thread::hardware_concurrency ()), 1))

create thread pool.

Parameters
workersnumber of worker threads.

◆ ~ThreadPool()

ThreadPool::~ThreadPool ( )

destroy thread pool.

Member Function Documentation

◆ push()

template<class Function , class... Args>
void join::ThreadPool::push ( Function && func,
Args &&... args )
inline

push a job to the work queue.

◆ size()

size_t ThreadPool::size ( )

return thread pool size.

Friends And Related Symbol Documentation

◆ WorkerThread

friend class WorkerThread
friend

friendship with worker thread.


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