pub struct SubmissionQueue<'a, E: EntryMarker = Entry> { /* private fields */ }
Expand description
An io_uring instance’s submission queue. This is used to send I/O requests to the kernel.
Implementations§
Source§impl<E: EntryMarker> SubmissionQueue<'_, E>
impl<E: EntryMarker> SubmissionQueue<'_, E>
Sourcepub fn sync(&mut self)
pub fn sync(&mut self)
Synchronize this type with the real submission queue.
This will flush any entries added by push
or
push_multiple
and will update the queue’s length if the kernel has
consumed some entries in the meantime.
Sourcepub fn need_wakeup(&self) -> bool
pub fn need_wakeup(&self) -> bool
When is_setup_sqpoll
is set, whether the kernel
threads has gone to sleep and requires a system call to wake it up.
A result of false
is only meaningful if the function was called after the latest update
to the queue head. Other interpretations could lead to a race condition where the kernel
concurrently put the device to sleep and no further progress is made.
Sourcepub fn need_wakeup_after_intermittent_seqcst(&self) -> bool
pub fn need_wakeup_after_intermittent_seqcst(&self) -> bool
The effect of Self::need_wakeup
, after synchronization work performed by the caller.
This function should only be called if the caller can guarantee that a SeqCst
fence has
been inserted after the last write to the queue’s head. The function is then a little more
efficient by avoiding to perform one itself.
Failure to uphold the precondition can result in an effective dead-lock due to a sleeping device.
Sourcepub fn dropped(&self) -> u32
pub fn dropped(&self) -> u32
The number of invalid submission queue entries that have been encountered in the ring buffer.
Sourcepub fn cq_overflow(&self) -> bool
pub fn cq_overflow(&self) -> bool
Returns true
if the completion queue ring is overflown.
Sourcepub fn taskrun(&self) -> bool
pub fn taskrun(&self) -> bool
Returns true
if completions are pending that should be processed. Only relevant when used
in conjuction with the setup_taskrun_flag
function. Available since 5.19.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Get the total number of entries in the submission queue ring buffer.
Sourcepub fn is_full(&self) -> bool
pub fn is_full(&self) -> bool
Returns true
if the submission queue ring buffer has reached capacity, and no more events
can be added before the kernel consumes some.
Sourcepub unsafe fn push(&mut self, entry: &E) -> Result<(), PushError>
pub unsafe fn push(&mut self, entry: &E) -> Result<(), PushError>
Attempts to push an entry into the queue. If the queue is full, an error is returned.
§Safety
Developers must ensure that parameters of the entry (such as buffer) are valid and will be valid for the entire duration of the operation, otherwise it may cause memory problems.
Sourcepub unsafe fn push_multiple(&mut self, entries: &[E]) -> Result<(), PushError>
pub unsafe fn push_multiple(&mut self, entries: &[E]) -> Result<(), PushError>
Attempts to push several entries into the queue. If the queue does not have space for all of the entries, an error is returned.
§Safety
Developers must ensure that parameters of all the entries (such as buffer) are valid and will be valid for the entire duration of the operation, otherwise it may cause memory problems.