A thread pool for scheduling and executing jobs in parallel.
More...
#include <ThreadPool.h>
|
| | ThreadPool (u8 threadCount) |
| | Constructs the thread pool with a given number of threads.
|
| | ~ThreadPool () |
| | Destructor that stops all threads and cleans up.
|
| void | Enqueue (Job job) |
| | Adds a job to the pool's queue to be executed by a worker.
|
A thread pool for scheduling and executing jobs in parallel.
Creates a fixed number of worker threads that wait on a condition variable for new jobs to arrive in the JobQueue. Jobs are enqueued via Enqueue(), and workers automatically pick them up and execute them.
◆ ThreadPool()
| Raven::ThreadPool::ThreadPool |
( |
u8 | threadCount | ) |
|
|
inlineexplicit |
Constructs the thread pool with a given number of threads.
- Parameters
-
| threadCount | The number of worker threads to spawn. If zero, defaults to 25% of the hardware concurrency. |
◆ ~ThreadPool()
| Raven::ThreadPool::~ThreadPool |
( |
| ) |
|
|
inline |
Destructor that stops all threads and cleans up.
Gracefully stops the thread pool and joins all worker threads.
◆ Enqueue()
| void Raven::ThreadPool::Enqueue |
( |
Job | job | ) |
|
|
inline |
Adds a job to the pool's queue to be executed by a worker.
- Parameters
-
| job | The job to enqueue for execution. |
The documentation for this class was generated from the following files: