Discord.C++ 0.13.0
Loading...
Searching...
No Matches
DiscordCPP::Threadpool Class Reference

#include <Threadpool.h>

Public Member Functions

 Threadpool (const unsigned int size=4)
 
 Threadpool (const Threadpool &)=delete
 
 ~Threadpool ()
 
template<typename F , typename R = std::invoke_result_t<std::decay_t<F>>, typename = std::enable_if_t<!std::is_void_v<R>>>
SharedFuture< R > execute (F &&task)
 
template<typename F , typename = std::enable_if_t<std::is_void_v<std::invoke_result_t<std::decay_t<F>>>>>
SharedFuture< void > execute (F &&task)
 

Constructor & Destructor Documentation

◆ Threadpool() [1/2]

DiscordCPP::Threadpool::Threadpool ( const unsigned int size = 4)
explicit

Creates a new Threadpool.

Parameters
[in]size(optional) The number of threads the threadpool should contain. Defaults to 4.

◆ Threadpool() [2/2]

DiscordCPP::Threadpool::Threadpool ( const Threadpool & )
delete

◆ ~Threadpool()

DiscordCPP::Threadpool::~Threadpool ( )

Member Function Documentation

◆ execute() [1/2]

template<typename F , typename R = std::invoke_result_t<std::decay_t<F>>, typename = std::enable_if_t<!std::is_void_v<R>>>
SharedFuture< R > DiscordCPP::Threadpool::execute ( F && task)
inline

Executes a function on the Threadpool.

Parameters
[in]taskfunction to be executed.
Returns
shared future that will contain the result produced by task.

◆ execute() [2/2]

template<typename F , typename = std::enable_if_t<std::is_void_v<std::invoke_result_t<std::decay_t<F>>>>>
SharedFuture< void > DiscordCPP::Threadpool::execute ( F && task)
inline

Executes a function on the Threadpool.

Parameters
[in]taskfunction to be executed.
Returns
shared future that will contain the result produced by task.

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