|
VLink 2.0.0
A high-performance communication middleware
|
An absolute-deadline timer for lightweight, lock-free timeout tracking. 更多...
类 | |
| class | vlink::DeadlineTimer |
| Atomic absolute-deadline timer for lock-free timeout detection. 更多... | |
命名空间 | |
| namespace | vlink |
An absolute-deadline timer for lightweight, lock-free timeout tracking.
DeadlineTimer stores an absolute expiry timestamp (rather than a countdown duration) in an atomic 64-bit word, making it safe to read from multiple threads without a mutex. It is used inside VLink connection and request handling to detect expired operations.
The deadline can be set in two ways:
set_deadline(interval) – sets the deadline interval time units from now.set_deadline_abs(abs) – sets an explicit absolute timestamp.The same Accuracy enum from ElapsedTimer is reused to select millisecond, microsecond, or nanosecond granularity.
DeadlineTimer has deadline() == 0 and is_valid() == false. Always call set_deadline() before checking has_expired().remaining_time() returns 0 once the deadline has already passed; callers should treat any value <= 0 as expired.