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