scc 2025.09
SystemC components library
util::thread_pool Struct Reference

a simple thread pool More...

#include <thread_pool.h>

Public Member Functions

template<class F, class... Args>
auto enqueue (F &&f, Args &&... args) -> std::future< typename std::result_of< F(Args...)>::type >
void start (std::size_t N=1)
void abort ()
void cancel_pending ()
void finish ()

Public Attributes

std::mutex m
std::condition_variable v
std::deque< std::packaged_task< void()> > work
std::vector< std::future< void > > finished

Detailed Description

a simple thread pool

Definition at line 33 of file thread_pool.h.

Constructor & Destructor Documentation

◆ ~thread_pool()

util::thread_pool::~thread_pool ( )
inline

Definition at line 88 of file thread_pool.h.

Member Function Documentation

◆ abort()

void util::thread_pool::abort ( )
inline

Definition at line 68 of file thread_pool.h.

◆ cancel_pending()

void util::thread_pool::cancel_pending ( )
inline

Definition at line 73 of file thread_pool.h.

◆ enqueue()

template<class F, class... Args>
auto util::thread_pool::enqueue ( F && f,
Args &&... args )->std::future< typenamestd::result_of< F(Args...)>::type >
inline

Definition at line 46 of file thread_pool.h.

◆ finish()

void util::thread_pool::finish ( )
inline

Definition at line 78 of file thread_pool.h.

◆ start()

void util::thread_pool::start ( std::size_t N = 1)
inline

Definition at line 60 of file thread_pool.h.

Member Data Documentation

◆ finished

std::vector<std::future<void> > util::thread_pool::finished

Definition at line 40 of file thread_pool.h.

◆ m

std::mutex util::thread_pool::m

Definition at line 35 of file thread_pool.h.

◆ v

std::condition_variable util::thread_pool::v

Definition at line 36 of file thread_pool.h.

◆ work

std::deque<std::packaged_task<void()> > util::thread_pool::work

Definition at line 38 of file thread_pool.h.


The documentation for this struct was generated from the following file:
  • /home/eyck/Projects/MINRES/SystemC-Components/src/common/util/thread_pool.h