MGIS 3.1.0
Loading...
Searching...
No Matches
mgis::ThreadPool Struct Reference

structure handling a fixed-size pool of threads More...

#include </home/runner/work/MFrontGenericInterfaceSupport/MFrontGenericInterfaceSupport/include/MGIS/ThreadPool.hxx>

Public Member Functions

 ThreadPool (const size_type)
 constructor
template<typename F, typename... Args>
std::future< ThreadedTaskResult< std::invoke_result_t< F, Args... > > > addTask (F &&, Args &&...)
 add a new task
size_type getNumberOfThreads () const
void wait ()
 wait for all tasks to be finished
 ~ThreadPool ()
 destructor
template<typename F, typename... Args>
std::future< ThreadedTaskResult< std::invoke_result_t< F, Args... > > > addTask (F &&f, Args &&... a)

Detailed Description

structure handling a fixed-size pool of threads

Constructor & Destructor Documentation

◆ ThreadPool()

mgis::ThreadPool::ThreadPool ( const size_type )

constructor

Parameters
[in]nnumber of thread to be created

Member Function Documentation

◆ addTask()

template<typename F, typename... Args>
std::future< ThreadedTaskResult< std::invoke_result_t< F, Args... > > > mgis::ThreadPool::addTask ( F && ,
Args && ... )
nodiscard

add a new task

Parameters
[in]ftask
[in]aarguments passed to the the task
Note
the task and its arguments are copied (or moved) and stored by the pool, as by std::thread

◆ getNumberOfThreads()

size_type mgis::ThreadPool::getNumberOfThreads ( ) const
nodiscard
Returns
the number of threads managed by the ppol

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