|
C++ Concurrency Sandbox
|
A basic implementation of a persistent Worker Thread Pool. More...
#include <iostream>#include <vector>#include <thread>#include <functional>#include <mutex>#include <queue>#include <condition_variable>#include <atomic>#include <chrono>Go to the source code of this file.
Classes | |
| class | ThreadPool |
| Manages a collection of threads that execute tasks from a shared queue. More... | |
Typedefs | |
| typedef std::function< void()> | Task |
Functions | |
| void | dataProcessingTask (int id) |
| Simulates a CPU-bound data processing task. | |
| int | main () |
| Main function demonstrating mass task submission. | |
Variables | |
| std::mutex | log_mtx |
| Global mutex for synchronized console logging. | |
A basic implementation of a persistent Worker Thread Pool.
Definition in file BasicThreadPool.cpp.
| typedef std::function<void()> Task |
Definition at line 23 of file BasicThreadPool.cpp.
| void dataProcessingTask | ( | int | id | ) |
Simulates a CPU-bound data processing task.
| id | The task identifier. |
Definition at line 123 of file BasicThreadPool.cpp.
References log_mtx.
Referenced by main().
| int main | ( | void | ) |
Main function demonstrating mass task submission.
Definition at line 134 of file BasicThreadPool.cpp.
References dataProcessingTask(), ThreadPool::enqueue(), and log_mtx.
| std::mutex log_mtx |
Global mutex for synchronized console logging.
Definition at line 28 of file BasicThreadPool.cpp.
Referenced by dataProcessingTask(), and main().