Manages a pool of worker threads for concurrent task execution.
More...
#include <ThreadPool2.hxx>
|
static char const * | Name () |
| Returns the name of the thread pool.
|
|
|
typedef std::function< void(void)> | FUN |
|
Manages a pool of worker threads for concurrent task execution.
The ThreadPool2
class is derived from ThreadPoolBase
and provides functionality to execute tasks concurrently using a pool of worker threads. Based on tghe code from https://github.com/nbsdx/ThreadPool/tree/master
◆ ThreadPool2()
Utils::ThreadPool2::ThreadPool2 |
( |
unsigned | nthread = std::max( unsigned(1), unsigned(std::thread::hardware_concurrency()-1) ) | ) |
|
|
inlineexplicit |
Constructs a new ThreadPool1 with a specified number of threads.
- Parameters
-
nthread | Number of threads to create (default: hardware concurrency - 1). |
◆ ~ThreadPool2()
virtual Utils::ThreadPool2::~ThreadPool2 |
( |
| ) |
|
|
inlinevirtual |
◆ exec()
void Utils::ThreadPool2::exec |
( |
FUN && | fun | ) |
|
|
inlineoverridevirtual |
Executes a task in the thread pool.
- Parameters
-
job | The function to be executed. |
Implements Utils::ThreadPoolBase.
◆ Name()
static char const * Utils::ThreadPool2::Name |
( |
| ) |
|
|
inlinestatic |
Returns the name of the thread pool.
◆ name()
char const * Utils::ThreadPool2::name |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ thread_count()
unsigned Utils::ThreadPool2::thread_count |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns the number of threads in the pool.
- Returns
- The number of threads.
Implements Utils::ThreadPoolBase.
◆ wait()
void Utils::ThreadPool2::wait |
( |
| ) |
|
|
inlineoverridevirtual |
The documentation for this class was generated from the following file:
- /Users/enricobertolazzi/Ricerca/PINS/PINS-submodules/UtilsLite/src/Utils/ThreadPool2.hxx