#[repr(align(128))]
pub(crate) struct ScheduledIo { pub(super) linked_list_pointers: UnsafeCell<Pointers<Self>>, readiness: AtomicUsize, waiters: Mutex<Waiters>, }
Expand description

Stored in the I/O driver resource slab.

Fields§

§linked_list_pointers: UnsafeCell<Pointers<Self>>§readiness: AtomicUsize

Packs the resource’s readiness and I/O driver latest tick.

§waiters: Mutex<Waiters>

Implementations§

source§

impl ScheduledIo

source

pub(crate) fn token(&self) -> Token

source

pub(super) fn shutdown(&self)

Invoked when the IO driver is shut down; forces this ScheduledIo into a permanently shutdown state.

source

pub(super) fn set_readiness(&self, tick: Tick, f: impl Fn(Ready) -> Ready)

Sets the readiness on this ScheduledIo by invoking the given closure on the current value, returning the previous readiness value.

Arguments
  • tick: whether setting the tick or trying to clear readiness for a specific tick.
  • f: a closure returning a new readiness value given the previous readiness.
source

pub(super) fn wake(&self, ready: Ready)

Notifies all pending waiters that have registered interest in ready.

There may be many waiters to notify. Waking the pending task must be done from outside of the lock otherwise there is a potential for a deadlock.

A stack array of wakers is created and filled with wakers to notify, the lock is released, and the wakers are notified. Because there may be more than 32 wakers to notify, if the stack array fills up, the lock is released, the array is cleared, and the iteration continues.

source

pub(super) fn ready_event(&self, interest: Interest) -> ReadyEvent

source

pub(super) fn poll_readiness( &self, cx: &mut Context<'_>, direction: Direction ) -> Poll<ReadyEvent>

Polls for readiness events in a given direction.

These are to support AsyncRead and AsyncWrite polling methods, which cannot use the async fn version. This uses reserved reader and writer slots.

source

pub(crate) fn clear_readiness(&self, event: ReadyEvent)

source

pub(crate) fn clear_wakers(&self)

source§

impl ScheduledIo

source

pub(crate) async fn readiness(&self, interest: Interest) -> ReadyEvent

An async version of poll_readiness which uses a linked list of wakers.

source

fn readiness_fut(&self, interest: Interest) -> Readiness<'_>

Trait Implementations§

source§

impl Debug for ScheduledIo

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for ScheduledIo

source§

fn default() -> ScheduledIo

Returns the “default value” for a type. Read more
source§

impl Drop for ScheduledIo

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for ScheduledIo

source§

impl Sync for ScheduledIo

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.