24#include "3rd/BS_thread_pool.hpp"
53 BS::light_thread_pool m_pool;
63 unsigned nthread = std::max(
65 unsigned(std::thread::hardware_concurrency()-1)
67 ) : m_pool( nthread ) {}
81 void exec(
FUN && fun )
override { m_pool.detach_task( std::move(fun) ); }
86 void wait()
override { m_pool.wait(); }
93 unsigned thread_count()
const override {
return unsigned( m_pool.get_thread_count() ); }
100 static char const *
Name() {
return "ThreadPool3 [BS]"; }
102 char const *
name()
const override {
return Name(); }
void wait() override
Waits for all tasks to be completed.
Definition ThreadPool3.hxx:86
ThreadPool3(unsigned nthread=std::max(unsigned(1), unsigned(std::thread::hardware_concurrency() -1)))
Constructs a new ThreadPool5 instance with a specified number of threads.
Definition ThreadPool3.hxx:62
void exec(FUN &&fun) override
Executes a task and assigns it to an available worker.
Definition ThreadPool3.hxx:81
static char const * Name()
Gets the name of the thread pool implementation.
Definition ThreadPool3.hxx:100
virtual ~ThreadPool3()
Destructor for the ThreadPool5 class.
Definition ThreadPool3.hxx:74
unsigned thread_count() const override
Gets the current number of threads in the pool.
Definition ThreadPool3.hxx:93
char const * name() const override
Definition ThreadPool3.hxx:102
ThreadPoolBase(ThreadPoolBase const &)=delete
std::function< void(void)> FUN
Definition ThreadPoolBase.hxx:55
Definition SystemUtils.cc:39