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=int(CpuTopology::instance() ->cores().size()))
 create thread pool.
 
 ThreadPool (const ThreadPool &other)=delete
 copy constructor.
 
ThreadPooloperator= (const ThreadPool &other)=delete
 copy assignment.
 
 ThreadPool (ThreadPool &&other)=delete
 move constructor.
 
ThreadPooloperator= (ThreadPool &&other)=delete
 move assignment.
 
 ~ThreadPool () noexcept
 destroy thread pool.
 
template<class Function , class... Args>
void push (Function &&func, Args &&... args)
 push a job to the work queue.
 
size_t size () const noexcept
 return thread pool size.
 

Friends

class WorkerThread
 friendship with worker thread.
 

Detailed Description

thread pool class.

Constructor & Destructor Documentation

◆ ThreadPool() [1/3]

ThreadPool::ThreadPool ( int workers = int (CpuTopology::instance ()->cores ().size ()))

create thread pool.

Parameters
workersnumber of worker threads.

◆ ThreadPool() [2/3]

join::ThreadPool::ThreadPool ( const ThreadPool & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ ThreadPool() [3/3]

join::ThreadPool::ThreadPool ( ThreadPool && other)
delete

move constructor.

Parameters
otherother object to move.

◆ ~ThreadPool()

ThreadPool::~ThreadPool ( )
noexcept

destroy thread pool.

Member Function Documentation

◆ operator=() [1/2]

ThreadPool & join::ThreadPool::operator= ( const ThreadPool & other)
delete

copy assignment.

Parameters
otherother object to copy.
Returns
a reference to the current object.

◆ operator=() [2/2]

ThreadPool & join::ThreadPool::operator= ( ThreadPool && other)
delete

move assignment.

Parameters
otherother object to move.
Returns
a reference to the current object.

◆ push()

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

push a job to the work queue.

Parameters
funccallable to execute.
argsarguments to pass to the callable.

◆ size()

size_t ThreadPool::size ( ) const
noexcept

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: