|
threadman 0.1.0
Header-only C++23 managed threads, dynamic pools, futures, and executors
|
threadman::FutureWaitPool — a dynamically-scaling executor specialized for blocking waits, primarily adopting std::future / std::shared_future into ThreadMan's Future<T>.
More...
#include <threadman/config.hpp>#include <threadman/executor.hpp>#include <threadman/future.hpp>#include <threadman/stats.hpp>#include <threadman/thread_pool.hpp>#include <commons/display_info.hpp>#include <chrono>#include <cstddef>#include <cstdint>#include <exception>#include <functional>#include <future>#include <memory>#include <string>#include <string_view>#include <thread>#include <type_traits>#include <utility>#include <vector>

Go to the source code of this file.
Classes | |
| struct | threadman::FutureWaitPoolOptions |
Configuration for a FutureWaitPool. More... | |
| class | threadman::FutureWaitPool |
| Elastic executor for blocking future-waits. More... | |
Namespaces | |
| namespace | threadman |
threadman::FutureWaitPool — a dynamically-scaling executor specialized for blocking waits, primarily adopting std::future / std::shared_future into ThreadMan's Future<T>.
A std::future offers no completion callback, so the only way to learn it is ready is to block a thread on get(). That makes a fixed-size pool a poor fit: a handful of slow futures can occupy every worker. FutureWaitPool wraps a ThreadPool tuned for exactly this — it keeps min_workers core threads and scales up to max_workers whenever waits back up (a worker blocked in get() counts as active, never idle, so saturation reliably triggers scale-up), then retires the overflow once the backlog clears.
Typical use:
The returned value is a first-class threadman::Future<T>: it supports .get(), .then(), .on_error(), snapshots, and share() like any other.