|
VLink
2.0.0
A high-performance communication middleware
|
Atomic absolute-deadline timer used for lock-free timeout tracking on hot paths. 更多...
类 | |
| class | vlink::DeadlineTimer |
| Cache-line aligned atomic deadline counter with millisecond / microsecond / nanosecond precision. 更多... | |
命名空间 | |
| vlink | |
Atomic absolute-deadline timer used for lock-free timeout tracking on hot paths.
DeadlineTimer stores a single absolute monotonic timestamp inside a 64-bit atomic, which makes deadline checks branch-light and concurrent reads safe without external locking. It is used inside connection bookkeeping and RPC request tracking to detect expired operations.
* +--------+ set_deadline / set_deadline_abs +---------+ now >= deadline +----------+ * | idle | ------------------------------> | armed | --------------> | expired | * | (zero) | | | +----------+ * +--------+ <------- reset() --------------- +---------+ | * ^ | * +----------------------- reset() / set 0 --------------------------------+ *
vlink::Timer | Aspect | vlink::DeadlineTimer | vlink::Timer |
|---|---|---|
| Purpose | Track a single deadline | Schedule repeating callbacks |
| Backing storage | One atomic<uint64_t> | Loop-managed timer list |
| Owns a thread | No | Owned by an attached MessageLoop |
| Cost per check | One atomic load | Insertion / removal on the loop |
| Cancellation | reset() | detach() on the timer instance |