Skip to main content

RingWait

Struct RingWait 

Source
pub struct RingWait<'ring> { /* private fields */ }
Expand description

The ring, narrowed to what a CompletionWait needs (M21.2).

Deliberately exposes no way to pop and no way to submit work. A waiter that could pop would consume the completion its own caller is waiting for, and one that could submit would queue entries the caller never asked for – both of which a bare &mut IoRing would permit. This is the same narrowing, for the same reason, as RingScope under D-43.

Implementations§

Source§

impl RingWait<'_>

Source

pub fn block(&mut self, timeout_ms: u32) -> Result<()>

Block in the ring’s own wait for up to timeout_ms, queueing nothing.

With no new entries of its own, SubmitIoRing’s effect here is to submit whatever is already queued and wait for an outstanding operation to complete – the same call IoRing::run_down uses to quiesce. Note submit: a Build* that has queued an SQE but not yet submitted it will be submitted by this call, which is why the narrowing below is about not letting a waiter build work, not about suppressing submission.

An expired wait is Ok, not an error. Returning therefore does not mean a completion is poppable – the bound may simply have run out – which is why the loop that calls this re-checks either way.

§At least one operation must really be outstanding

Measured while building this: SubmitIoRing answers E_INVALIDARG (0x80070057) – not a timeout – when asked to wait for a completion the kernel has no pending operation for. A RingWait is only ever constructed by IoRing::pop_within_with, which checks IoRing::outstanding before consulting the wait, so that precondition holds structurally rather than by the caller remembering it. A waiter that wants to block some other way is free to ignore this method entirely.

§Errors

Any error from SubmitIoRing other than an expired wait.

Source

pub fn outstanding(&self) -> usize

Operations submitted but not yet observed complete, as IoRing::outstanding.

A waiter that multiplexes several sources can use this to decide whether blocking on this ring is worth a slot at all.

Auto Trait Implementations§

§

impl<'ring> !Send for RingWait<'ring>

§

impl<'ring> !Sync for RingWait<'ring>

§

impl<'ring> Freeze for RingWait<'ring>

§

impl<'ring> RefUnwindSafe for RingWait<'ring>

§

impl<'ring> Unpin for RingWait<'ring>

§

impl<'ring> UnsafeUnpin for RingWait<'ring>

§

impl<'ring> UnwindSafe for RingWait<'ring>

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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.