World Builder  1.1.0-pre
A geodynamic initial conditions generator
ThreadPool Class Reference

Public Member Functions

 ThreadPool (size_t number_of_threads)
 
template<typename Callable >
void parallel_for (size_t start, size_t end, Callable func)
 

Private Attributes

std::vector< std::thread > pool
 

Detailed Description

A very simple threadpool class. The threadpool currently only supports a parallel for function, to easily parallelize the for function.

Todo: might need something more advanced and safe in the future.

Definition at line 154 of file main.cc.

Constructor & Destructor Documentation

◆ ThreadPool()

ThreadPool::ThreadPool ( size_t  number_of_threads)
inlineexplicit

Constructor

Definition at line 161 of file main.cc.

Member Function Documentation

◆ parallel_for()

template<typename Callable >
void ThreadPool::parallel_for ( size_t  start,
size_t  end,
Callable  func 
)
inline

A function which allows to parallelize for loops.

Definition at line 170 of file main.cc.

Member Data Documentation

◆ pool

std::vector<std::thread> ThreadPool::pool
private

Definition at line 211 of file main.cc.


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