Skip to main content

ProcessCompletion

Enum ProcessCompletion 

Source
pub enum ProcessCompletion {
    Sync,
    Async(Receiver<()>),
}
Expand description

The completion outcome of an externally-initiated record process cycle — the value a caller learns after driving the synchronous head of a dbPutNotify / CA WRITE_NOTIFY.

This is the contract the RTEMS CA driver consumes: the CA thread drives the synchronous head of a put (C dbProcessNotify, rsrv/camessage.c write_notify_action) to completion — on RTEMS via park_on — then matches this value to decide whether to reply inline or return now and let background infrastructure deliver the completion later. The caller learns sync-vs-async as a typed value, not by inferring it from Option::is_some.

§C parity (dbNotify.c)

The C processNotify state machine forks a put-notify exactly here:

  • Self::Sync — the record was neither active (pact) nor selected for processing, so processNotifyCommon runs callDone (dbNotify.c:270), which fires doneCallback INLINE on the calling thread (dbNotify.c:182). Our fully-synchronous chain drains the NotifyWaitSet before the put entry returns.
  • Self::Async — the record was pact (notifyRestartInProgress, dbNotify.c:225-231) or processed into an async device (notifyProcessInProgress, dbNotify.c:252-263). Completion is deferred to dbNotifyCompletion (dbNotify.c:445-475), which fires the user callback via callbackRequest (:466/:470) when the tracked waitList empties. Our NotifyWaitSet::leave-to-zero fires the handle oneshot at that same moment.

§Invariant (by construction)

Exactly one of {Sync returned, the Async handle fires exactly once} per initiated cycle. The single owner of the fire is NotifyWaitSet: its leave-to-zero takes the oneshot sender and sends once, so the handle can never fire twice; and Sync is returned only when the wait-set already drained, so no handle is outstanding to fire. There is no parallel signalling path — the oneshot is the sole completion channel.

Variants§

§

Sync

The cycle settled within the calling thread — the caller replies inline.

§

Async(Receiver<()>)

The cycle went async; handle fires exactly once when the tracked FLNK/OUT chain settles (C dbNotifyCompletion).

Implementations§

Source§

impl ProcessCompletion

Source

pub fn into_handle(self) -> Option<Receiver<()>>

The completion handle if this cycle went async, else None. The CA WRITE_NOTIFY dispatch uses this to choose inline reply (None) vs a spawned completion task (Some(rx)).

Source

pub fn is_async(&self) -> bool

True if the cycle went async (a completion handle is outstanding).

Source

pub fn is_sync(&self) -> bool

True if the cycle completed synchronously (no handle to await).

Trait Implementations§

Source§

impl Debug for ProcessCompletion

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more