LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
GlobalThreadPool Class Reference

Simple wrapper around BS::thread_pool that makes a BS::thread_pool a singleton, such that a thread pool can be used around in the code, and safely spawn threads also from other threads. Only wraps a submit() and push_task for now. More...

#include <lasp_thread.h>

Public Member Functions

 GlobalThreadPool ()
 Instantiate handle to the thread pool.
 
 GlobalThreadPool (const GlobalThreadPool &)=default
 
GlobalThreadPooloperator= (const GlobalThreadPool &)=default
 
template<typename F , typename... A, typename R = std::invoke_result_t<std::decay_t<F>, std::decay_t<A>...>>
std::future< R > submit (F &&task, A &&...args)
 Wrapper around BS::thread_pool::submit(...)
 
template<typename F , typename... A>
void push_task (F &&task, A &&...args)
 Wrapper around BS::thread_pool::push_task(...)
 

Detailed Description

Simple wrapper around BS::thread_pool that makes a BS::thread_pool a singleton, such that a thread pool can be used around in the code, and safely spawn threads also from other threads. Only wraps a submit() and push_task for now.

Definition at line 10 of file lasp_thread.h.

Constructor & Destructor Documentation

◆ GlobalThreadPool() [1/2]

GlobalThreadPool::GlobalThreadPool ( )

Instantiate handle to the thread pool.

See if we can get it from the global ptr. If not, time to allocate it.

Definition at line 23 of file lasp_thread.cpp.

◆ GlobalThreadPool() [2/2]

GlobalThreadPool::GlobalThreadPool ( const GlobalThreadPool )
default

Member Function Documentation

◆ operator=()

GlobalThreadPool & GlobalThreadPool::operator= ( const GlobalThreadPool )
default

◆ push_task()

template<typename F , typename... A>
void GlobalThreadPool::push_task ( F &&  task,
A &&...  args 
)
inline

Wrapper around BS::thread_pool::push_task(...)

Definition at line 38 of file lasp_thread.h.

◆ submit()

template<typename F , typename... A, typename R = std::invoke_result_t<std::decay_t<F>, std::decay_t<A>...>>
std::future< R > GlobalThreadPool::submit ( F &&  task,
A &&...  args 
)
inline

Wrapper around BS::thread_pool::submit(...)

Definition at line 31 of file lasp_thread.h.


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