CoriEngine
Loading...
Searching...
No Matches
Cori::Core::Threading::ThreadPool Class Reference

#include <ThreadPool.hpp>

Public Member Functions

 ThreadPool (const uint16_t numThreads)
 ~ThreadPool ()
uint16_t GetWorkerCount () const
 Returns a number of threads allocated for this thread pool.
template<class F, class... Args>
std::future< std::invoke_result_t< F, Args... > > Submit (F &&f, Args &&... args)
 Submits a task to be executed on the thread of this thread pool.

Detailed Description

Definition at line 7 of file ThreadPool.hpp.

Constructor & Destructor Documentation

◆ ThreadPool()

Cori::Core::Threading::ThreadPool::ThreadPool ( const uint16_t numThreads)
inlineexplicit

Definition at line 9 of file ThreadPool.hpp.

◆ ~ThreadPool()

Cori::Core::Threading::ThreadPool::~ThreadPool ( )
inline

Definition at line 33 of file ThreadPool.hpp.

Member Function Documentation

◆ GetWorkerCount()

uint16_t Cori::Core::Threading::ThreadPool::GetWorkerCount ( ) const
inline

Returns a number of threads allocated for this thread pool.

Returns
Number of threads.

Definition at line 48 of file ThreadPool.hpp.

◆ Submit()

template<class F, class... Args>
std::future< std::invoke_result_t< F, Args... > > Cori::Core::Threading::ThreadPool::Submit ( F && f,
Args &&... args )
inline

Submits a task to be executed on the thread of this thread pool.

It is safe to call this function from any thread.

Template Parameters
FAuto deduced callable type.
ArgsAuto deduced callable argument types.
Parameters
fTask callable, no specific signature required.
argsArguments that will be passed to the callable task upon execution.
Returns
Future that will hold the result of invoke result of the passed callable.

Definition at line 62 of file ThreadPool.hpp.


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