|
XNetwork 1.7.8
|
#include <condition_variable>#include <functional>#include <future>#include <memory>#include <mutex>#include <queue>#include <thread>#include <type_traits>#include <utility>Go to the source code of this file.
Classes | |
| class | xnetwork::thread_pool |
| Command pattern: tasks are encapsulated as command objects (std::function<void()>) placed in a shared queue; producers (enqueue) are decoupled from executors (worker threads). More... | |
Namespaces | |
| namespace | xnetwork |
Minimal header-only thread pool for C++17.
Owns a fixed set of worker threads that process tasks from a shared queue. Tasks are enqueued via enqueue() which returns a std::future to the result.
Usage:
The destructor waits for all pending tasks to finish and joins all worker threads. It is safe to destroy the pool while tasks are still running - remaining tasks are abandoned.