batmat 0.0.21
Batched linear algebra routines
Loading...
Searching...
No Matches
batmat::thread_pool Class Reference

#include <batmat/thread-pool.hpp>

Detailed Description

Definition at line 17 of file thread-pool.hpp.

Classes

struct  State

Public Member Functions

 thread_pool (size_t num_threads=std::thread::hardware_concurrency())
 thread_pool (const thread_pool &)=delete
thread_pooloperator= (const thread_pool &)=delete
 thread_pool (thread_pool &&)=default
thread_pooloperator= (thread_pool &&)=default
void schedule (size_t i, std::function< void()> func)
void wait (size_t i)
void wait_all ()
template<class I = size_t, class F>
void sync_run_all (F &&f)
template<class I = size_t, class F>
void sync_run_n (I n, F &&f)
size_t size () const

Private Attributes

std::vector< Statestates
std::vector< std::jthread > threads

Constructor & Destructor Documentation

◆ thread_pool() [1/3]

batmat::thread_pool::thread_pool ( size_t num_threads = std::thread::hardware_concurrency())
inlineexplicit

Definition at line 31 of file thread-pool.hpp.

◆ thread_pool() [2/3]

batmat::thread_pool::thread_pool ( const thread_pool & )
delete

◆ thread_pool() [3/3]

batmat::thread_pool::thread_pool ( thread_pool && )
default

Member Function Documentation

◆ operator=() [1/2]

thread_pool & batmat::thread_pool::operator= ( const thread_pool & )
delete

◆ operator=() [2/2]

thread_pool & batmat::thread_pool::operator= ( thread_pool && )
default

◆ schedule()

void batmat::thread_pool::schedule ( size_t i,
std::function< void()> func )
inline

Definition at line 43 of file thread-pool.hpp.

◆ wait()

void batmat::thread_pool::wait ( size_t i)
inline

Definition at line 51 of file thread-pool.hpp.

◆ wait_all()

void batmat::thread_pool::wait_all ( )
inline

Definition at line 59 of file thread-pool.hpp.

◆ sync_run_all()

template<class I = size_t, class F>
void batmat::thread_pool::sync_run_all ( F && f)
inline

Definition at line 65 of file thread-pool.hpp.

◆ sync_run_n()

template<class I = size_t, class F>
void batmat::thread_pool::sync_run_n ( I n,
F && f )
inline

Definition at line 73 of file thread-pool.hpp.

◆ size()

size_t batmat::thread_pool::size ( ) const
inlinenodiscard

Definition at line 82 of file thread-pool.hpp.

Member Data Documentation

◆ states

std::vector<State> batmat::thread_pool::states
private

Definition at line 27 of file thread-pool.hpp.

◆ threads

std::vector<std::jthread> batmat::thread_pool::threads
private

Definition at line 28 of file thread-pool.hpp.


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