A single owned, cancellable, joinable timeout.
More...
#include <trace_timeout.hpp>
A single owned, cancellable, joinable timeout.
Not thread-safe against concurrent arm() calls — the caller serializes them (trace.cpp holds a dedicated mutex). cancel_and_join() is safe to call from any thread EXCEPT the worker itself, which would self-join.
◆ TimeoutController() [1/2]
| pulp::runtime::detail::TimeoutController::TimeoutController |
( |
| ) |
|
|
default |
◆ TimeoutController() [2/2]
| pulp::runtime::detail::TimeoutController::TimeoutController |
( |
const TimeoutController & | | ) |
|
|
delete |
◆ ~TimeoutController()
| pulp::runtime::detail::TimeoutController::~TimeoutController |
( |
| ) |
|
|
inline |
Joins any armed timeout. A controller must never outlive its worker.
◆ arm()
| void pulp::runtime::detail::TimeoutController::arm |
( |
std::chrono::milliseconds | delay, |
|
|
std::uint64_t | generation, |
|
|
std::function< void(std::uint64_t)> | on_expire ) |
|
inline |
Arm on_expire(generation) to run after delay.
Any previously armed timeout is cancelled and joined first, so two arms cannot leave two timers running against one session.
◆ armed()
| bool pulp::runtime::detail::TimeoutController::armed |
( |
| ) |
const |
|
inlinenoexcept |
True while a timeout thread exists (armed, running, or finished but not yet joined).
◆ cancel_and_join()
| void pulp::runtime::detail::TimeoutController::cancel_and_join |
( |
| ) |
|
|
inline |
Cancel an armed timeout and join its thread.
No-op when nothing is armed. Returns only once the worker is guaranteed not to run again — which is what makes module unload safe.
◆ operator=()
The documentation for this class was generated from the following file: