pub struct RouteWatch { /* private fields */ }Expand description
phase-503 W7 – an executor’s supervised routes, read from OUTSIDE it: from a port’s timer expiry, a reaction thread or an interrupt, while the spin thread is anywhere, including inside a dispatch.
A route is answered when the dispatch that publishes its output ends:
route_judge clears ROUTE_PENDING right there, on the executor’s
clock, in the row’s atomic cell. Until this type, a port’s independent timer
(MECHANISM_TIMER) learned that only from Executor::route_next_due_us
after the spin that answered it RETURNED, so a callback that answered
before the due inside a spin that ran past it looked like a miss at the
timer’s expiry (a false safe state on a board). Self::next_due_us reads
the cells at the moment of the call instead: Some(0) only when a take is
still unanswered at or after its deadline – the executor’s own verdict
(route_overdue, route_judge: an answer exactly at the deadline is a
miss).
It never touches the executor: the table and the clock it holds are fixed
once the monitors are installed (take it after set_monitor_table and any
clock change). Reading takes no lock and allocates nothing.
Implementations§
Source§impl RouteWatch
impl RouteWatch
Sourcepub const fn new(table: &'static [MonitorSpec], clock_us: fn() -> u64) -> Self
pub const fn new(table: &'static [MonitorSpec], clock_us: fn() -> u64) -> Self
A watch over table on clock_us (microseconds, the clock the
executor stamps takes with).
Sourcepub const fn table(&self) -> &'static [MonitorSpec]
pub const fn table(&self) -> &'static [MonitorSpec]
The watched table.
Sourcepub fn next_due_us(&self) -> Option<u64>
pub fn next_due_us(&self) -> Option<u64>
Microseconds from now to the earliest deadline of a pending supervised
route; Some(0) when one has passed with no answer; None when none
is waiting (every take answered, or none taken).
Trait Implementations§
Source§impl Clone for RouteWatch
impl Clone for RouteWatch
Source§fn clone(&self) -> RouteWatch
fn clone(&self) -> RouteWatch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more