![]() |
Libftpp
A modern C++ library
|
Worker Pool for Concurrent Job Execution. More...
#include <worker_pool.hpp>
Classes | |
| class | IJobs |
| Interface for defining jobs to be executed by the worker pool. Classes implementing this interface must define the start() method. More... | |
Public Member Functions | |
| WorkerPool (const int &nbWorkers) | |
| ~WorkerPool () | |
| void | loop () |
| void | addJob (const std::function< void()> &jobToExecute) |
| void | addJob (IJobs &jobToExecute) |
Worker Pool for Concurrent Job Execution.
This class provides a pool of worker threads that can execute jobs concurrently. Jobs can be added to the pool, and worker threads will pick them up and execute them. The pool manages thread synchronization and job distribution automatically.
Definition at line 43 of file worker_pool.hpp.
| WorkerPool::WorkerPool | ( | const int & | nbWorkers | ) |
Definition at line 3 of file worker_pool.cpp.
References loop().
| WorkerPool::~WorkerPool | ( | ) |
Definition at line 32 of file worker_pool.cpp.
| void WorkerPool::addJob | ( | const std::function< void()> & | jobToExecute | ) |
Definition at line 54 of file worker_pool.cpp.
| void WorkerPool::addJob | ( | IJobs & | jobToExecute | ) |
Definition at line 63 of file worker_pool.cpp.
References WorkerPool::IJobs::start().
| void WorkerPool::loop | ( | ) |
Definition at line 13 of file worker_pool.cpp.
Referenced by WorkerPool().