OnixS C++ CME MDP Conflated UDP Handler 1.1.2
API documentation
Loading...
Searching...
No Matches
ThreadPool Class Reference

Public Member Functions

 ThreadPool (size_t capacity)
 ~ThreadPool ()
size_t size () const
size_t capacity () const
void start (Task &task)
ONIXS_CONFLATEDUDP_EXPORTED void start (Task &, const ThreadAffinity &)
ONIXS_CONFLATEDUDP_EXPORTED void joinAll ()

Detailed Description

Definition at line 116 of file ThreadPool.h.

Constructor & Destructor Documentation

◆ ThreadPool()

ThreadPool ( size_t capacity)
inlineexplicit

Initializes the pool of the requested capacity.

Definition at line 136 of file ThreadPool.h.

◆ ~ThreadPool()

~ThreadPool ( )
inline

Finalizes the instance.

Waits until all threads accomplish their tasks.

Definition at line 146 of file ThreadPool.h.

Member Function Documentation

◆ capacity()

size_t capacity ( ) const
inline

Maximal number of threads maintained by the given pool.

Definition at line 159 of file ThreadPool.h.

◆ joinAll()

ONIXS_CONFLATEDUDP_EXPORTED void joinAll ( )

Blocks until all threads accomplish their tasks.

◆ size()

size_t size ( ) const
inline

Number of active threads currently busy executing user-defined tasks.

Definition at line 153 of file ThreadPool.h.

◆ start() [1/2]

ONIXS_CONFLATEDUDP_EXPORTED void start ( Task & ,
const ThreadAffinity &  )

Spawns the new thread executing the given task. Binds the spawned thread to the defined set of cores/processors.

Raises exception if the number of active threads exceeds the predefined capacity of the pool.

◆ start() [2/2]

void start ( Task & task)
inline

Spawns the new thread executing the given task.

Raises exception if the number of active threads exceeds the predefined capacity of the pool.

Definition at line 169 of file ThreadPool.h.