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<'_>
impl RingWait<'_>
Sourcepub fn block(&mut self, timeout_ms: u32) -> Result<()>
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.
Sourcepub fn outstanding(&self) -> usize
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.