Struct tokio::runtime::scheduler::multi_thread::queue::Inner

source ·
pub(crate) struct Inner<T: 'static> {
    head: AtomicU64,
    tail: AtomicU32,
    buffer: Box<[UnsafeCell<MaybeUninit<Notified<T>>>; 256]>,
}

Fields§

§head: AtomicU64

Concurrently updated by many threads.

Contains two UnsignedShort values. The LSB byte is the “real” head of the queue. The UnsignedShort in the MSB is set by a stealer in process of stealing values. It represents the first value being stolen in the batch. The UnsignedShort indices are intentionally wider than strictly required for buffer indexing in order to provide ABA mitigation and make it possible to distinguish between full and empty buffers.

When both UnsignedShort values are the same, there is no active stealer.

Tracking an in-progress stealer prevents a wrapping scenario.

§tail: AtomicU32

Only updated by producer thread but read by many threads.

§buffer: Box<[UnsafeCell<MaybeUninit<Notified<T>>>; 256]>

Elements

Implementations§

source§

impl<T> Inner<T>

source

fn remaining_slots(&self) -> usize

source

fn len(&self) -> u32

source

fn is_empty(&self) -> bool

Trait Implementations§

source§

impl<T> Send for Inner<T>

source§

impl<T> Sync for Inner<T>

Auto Trait Implementations§

§

impl<T> !Freeze for Inner<T>

§

impl<T> !RefUnwindSafe for Inner<T>

§

impl<T> Unpin for Inner<T>

§

impl<T> !UnwindSafe for Inner<T>

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

§

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

§

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.