Skip to main content

RouteWatch

Struct RouteWatch 

Source
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

Source

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).

Source

pub const fn table(&self) -> &'static [MonitorSpec]

The watched table.

Source

pub const fn clock_us(&self) -> fn() -> u64

The clock the watch reads.

Source

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

Source§

fn clone(&self) -> RouteWatch

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RouteWatch

Source§

impl Debug for RouteWatch

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.