Skip to main content

Module delayed_timer

Module delayed_timer 

Source
Expand description

Delayed-callback timer facility — RTEMS-safe port of callbackRequestDelayed and its epicsTimerQueue usage in modules/database/src/ioc/db/callback.c.

§C parity

callbackInit allocates one timer queue for delayed requests (timerQueue = epicsTimerQueueAllocate(...), callback.c:300). callbackRequestDelayed(pcallback, seconds) (callback.c:410-419) starts a per-callback epicsTimer on that queue; when the timer expires, the queue’s worker calls notify (callback.c:404-408), which simply hands the callback to callbackRequest — i.e. the timer’s only job is to defer the enqueue by seconds, after which the normal callback executor runs it.

The Rust port keeps that split of responsibility: one timer thread owns a deadline-ordered queue and, on expiry, submits the callback into the CallbackHandle executor pool. It uses Condvar::wait_timeout on the nearest deadline — plain std, no tokio timer wheel — so it runs on RTEMS.

Structs§

DelayedTimer
The delayed-callback timer: one thread draining a deadline-ordered queue into the callback executor pool. Port of the timerQueue half of callback.c.
TimerHandle
Cheap, clonable submission side of a DelayedTimer — the seam route for deferred (SDLY/ODLY/watchdog-style) hand-offs.
WakeKey
Identifies one queued entry, and orders the queue: earliest deadline first, ties broken by submission order. Being a key rather than a field of the entry is what makes an entry addressable — a BinaryHeap can only pop its top, so an entry it holds is reachable by nobody and lives until its deadline no matter who has lost interest.