OpenLB 1.7
|
Pool of threads for CPU-based background processing. More...
#include <threadPool.h>
Public Member Functions | |
ThreadPool () | |
void | init (int nThreads, bool verbose) |
Initialization to be called by olbInit. | |
~ThreadPool () | |
unsigned | size () const |
Returns number of threads. | |
template<typename F > | |
void | scheduleAndForget (F &&f) |
Schedule F, tracking neither its return value nor completion. | |
template<typename F , typename R = std::invoke_result_t<std::decay_t<F>>> | |
std::future< R > | schedule (F &&f) |
Schedule F and return future of its return value. | |
void | wait () |
Blocks until all tasks are completed. | |
template<typename T > | |
void | waitFor (std::vector< std::future< T > > &futures) |
Blocks until all tasks producing the given futures are completed. | |
Pool of threads for CPU-based background processing.
Not intended for parallelization of performance critical paths but for background processing of e.g. VTK output to reduce blocking of simulation process.
Definition at line 47 of file threadPool.h.
|
inline |
Definition at line 86 of file threadPool.h.
|
inline |
Definition at line 115 of file threadPool.h.
|
inline |
Initialization to be called by olbInit.
Definition at line 99 of file threadPool.h.
References OLB_PRECONDITION.
|
inline |
Schedule F and return future of its return value.
Definition at line 145 of file threadPool.h.
References OLB_PRECONDITION.
|
inline |
Schedule F, tracking neither its return value nor completion.
Definition at line 132 of file threadPool.h.
References OLB_PRECONDITION.
|
inline |
Returns number of threads.
Definition at line 125 of file threadPool.h.
|
inline |
Blocks until all tasks are completed.
Definition at line 161 of file threadPool.h.
References OLB_PRECONDITION.
|
inline |
Blocks until all tasks producing the given futures are completed.
Definition at line 174 of file threadPool.h.