vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
Public Member Functions | Public Attributes | List of all members
vspline_threadpool::thread_pool Class Reference

#include <thread_pool.h>

Public Member Functions

 thread_pool (int nthreads=default_njobs)
 
int get_nthreads () const
 
void launch (std::function< void() > job)
 launch simply enqueues a job and calls notify_one. Such a job will run to it's completion and end silently - any communication of it's state has to be managed by the job itself. See multithread.h for code which takes care of managing the life cycle of a group of jobs by wrapping them in an additional outer function More...
 
void launch (std::function< void() > job, int njobs)
 overload of launch invoking the payload on several worker threads More...
 
 ~thread_pool ()
 

Public Attributes

std::mutex task_mutex
 
std::condition_variable task_cv
 
std::queue< std::function< void() > > task_queue
 

Detailed Description

Definition at line 101 of file thread_pool.h.

Constructor & Destructor Documentation

◆ thread_pool()

vspline_threadpool::thread_pool::thread_pool ( int  nthreads = default_njobs)
inline

Definition at line 180 of file thread_pool.h.

◆ ~thread_pool()

vspline_threadpool::thread_pool::~thread_pool ( )
inline

Definition at line 230 of file thread_pool.h.

Member Function Documentation

◆ get_nthreads()

int vspline_threadpool::thread_pool::get_nthreads ( ) const
inline

Definition at line 193 of file thread_pool.h.

◆ launch() [1/2]

void vspline_threadpool::thread_pool::launch ( std::function< void() >  job)
inline

launch simply enqueues a job and calls notify_one. Such a job will run to it's completion and end silently - any communication of it's state has to be managed by the job itself. See multithread.h for code which takes care of managing the life cycle of a group of jobs by wrapping them in an additional outer function

Definition at line 204 of file thread_pool.h.

◆ launch() [2/2]

void vspline_threadpool::thread_pool::launch ( std::function< void() >  job,
int  njobs 
)
inline

overload of launch invoking the payload on several worker threads

Definition at line 216 of file thread_pool.h.

Member Data Documentation

◆ task_cv

std::condition_variable vspline_threadpool::thread_pool::task_cv

Definition at line 119 of file thread_pool.h.

◆ task_mutex

std::mutex vspline_threadpool::thread_pool::task_mutex

Definition at line 118 of file thread_pool.h.

◆ task_queue

std::queue< std::function < void() > > vspline_threadpool::thread_pool::task_queue

Definition at line 123 of file thread_pool.h.


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