|
VLink 2.0.0
A high-performance communication middleware
|
Event-loop-driven periodic/one-shot timer with configurable priority. More...
Go to the source code of this file.
Classes | |
| class | vlink::Timer |
| Event-loop-driven repeating or one-shot timer. More... | |
Namespaces | |
| namespace | vlink |
Event-loop-driven periodic/one-shot timer with configurable priority.
Timer integrates with a MessageLoop to deliver callbacks on its thread. Unlike platform timers, the callback runs serially with all other tasks posted to the same loop, so no extra synchronisation is needed inside the callback.
Key features:
kInfinite for loop_count means repeat forever).kPriorityType message loops.kMinInterval (10000) to prevent busy-wait overhead.Timer does not fire until attached to a loop via attach().Lifecycle:
Timer (with or without a MessageLoop).attach() to bind to a loop.start() to arm the timer.stop() to disarm; restart() to reset the countdown.stop() and detach().interval_ms is zero, the interval falls back to kMinInterval (10000).MessageLoop is destroyed.call_once() is a convenience factory for fire-and-forget one-shot timers.