LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_thread.h
Go to the documentation of this file.
1#pragma once
2#include "BS_thread_pool.hpp"
3
11
15 std::shared_ptr<BS::thread_pool> _pool;
16
17public:
24
28 template <
29 typename F, typename... A,
30 typename R = std::invoke_result_t<std::decay_t<F>, std::decay_t<A>...>>
31 [[nodiscard]] std::future<R> submit(F &&task, A &&...args) {
32
33 return _pool->submit(task, args...);
34 }
38 template <typename F, typename... A> void push_task(F &&task, A &&...args) {
39 _pool->push_task(task, args...);
40 }
41};
Simple wrapper around BS::thread_pool that makes a BS::thread_pool a singleton, such that a thread po...
Definition lasp_thread.h:10
GlobalThreadPool()
Instantiate handle to the thread pool.
void push_task(F &&task, A &&...args)
Wrapper around BS::thread_pool::push_task(...)
Definition lasp_thread.h:38
GlobalThreadPool & operator=(const GlobalThreadPool &)=default
GlobalThreadPool(const GlobalThreadPool &)=default
std::future< R > submit(F &&task, A &&...args)
Wrapper around BS::thread_pool::submit(...)
Definition lasp_thread.h:31