|
threadman 0.1.0
Header-only C++23 managed threads, dynamic pools, futures, and executors
|
threadman::ManagedThread — RAII wrapper around std::jthread that publishes lifecycle state via a shared ControlBlock and registers itself with a ThreadManager for inspection.
More...
#include <threadman/config.hpp>#include <threadman/display.hpp>#include <threadman/log.hpp>#include <threadman/metrics.hpp>#include <threadman/stats.hpp>#include <commons/display_info.hpp>#include <atomic>#include <chrono>#include <concepts>#include <cstdint>#include <exception>#include <memory>#include <mutex>#include <optional>#include <stop_token>#include <string>#include <thread>#include <type_traits>#include <utility>

Go to the source code of this file.
Classes | |
| class | threadman::ManagedThread |
| struct | threadman::ManagedThread::ControlBlock |
Heap-resident publishing block — shared by the thread, the manager's registry (as weak_ptr), and any current() lookup. More... | |
| struct | threadman::ManagedThread::Options |
Namespaces | |
| namespace | threadman |
| namespace | threadman::detail |
Functions | |
| std::uint64_t | threadman::detail::next_thread_id () noexcept |
| std::uint64_t | threadman::detail::current_native_id () noexcept |
| void | threadman::detail::apply_native_name (const std::string &name) noexcept |
threadman::ManagedThread — RAII wrapper around std::jthread that publishes lifecycle state via a shared ControlBlock and registers itself with a ThreadManager for inspection.
ManagedThread is move-only. Its body may be either a free function / lambda (Fn(Args...)) or a stoppable one (Fn(std::stop_token, Args...)) — the constructor's concept selects the right overload of the underlying jthread. The worker entry function captures name, applies a best-effort pthread_setname_np, sets a thread-local current() pointer, and registers the control block with the manager. On thread exit it transitions the state to Completed or Failed and unregisters from the manager.