RingState

Struct RingState 

Source
pub struct RingState { /* private fields */ }
Expand description

Represents the state tracking structure for the ring buffer.

Implementations§

Source§

impl RingState

Source

pub const DELAY: usize = 16usize

Represents the delay until the next check.

Source

pub const EIDX_TERM: usize = 0usize

Represents an queue index to terminate a dequeue operation.

Source

pub const EIDX_DEQ: usize = 1usize

Represents an queue index for a dequeue operation.

Source

pub const fn new() -> Self

Creates a new RingState.

Source

pub unsafe fn next(&self) -> &AtomicPtr<Self>

Gets a reference to the next RingState.

§Safety

Caller must ensure next lifetime is at least as long as this RingState.

Source

pub unsafe fn load_next(&self) -> *mut Self

Gets a pointer to the next RingState.

§Safety

Caller must ensure next lifetime is at least as long as this RingState.

Source

pub unsafe fn set_next(&self, val: *mut Self)

Sets the next RingState.

§Safety

Caller must ensure val lifetime is at least as long as this RingState.

Source

pub fn unset_next(&self)

Unsets the next RingState.

Source

pub const fn next_check(&self) -> &AtomicUsize

Gets a reference to the next check value.

Source

pub fn load_next_check(&self) -> usize

Gets the next check value.

Source

pub fn set_next_check(&self, val: usize)

Sets the next check value.

Source

pub unsafe fn curr_thread(&self) -> &AtomicPtr<Self>

Gets a reference to the current thread RingState.

§Safety

Caller must ensure curr_thread lifetime is at least as long as this RingState.

Source

pub unsafe fn load_curr_thread(&self) -> *mut Self

Gets a pointer to the current thread RingState.

§Safety

Caller must ensure curr_thread lifetime is at least as long as this RingState.

Source

pub unsafe fn set_curr_thread(&self, val: *mut Self)

Sets the current thread RingState.

§Safety

Caller must ensure val lifetime is at least as long as this RingState.

Source

pub fn unset_curr_thread(&self)

Unsets the current thread RingState.

Source

pub const fn phase2(&self) -> &RingPhase2

Gets a reference to the phase2 value.

Source

pub fn phase2_mut(&mut self) -> &mut RingPhase2

Gets a mutable reference to the phase2 value.

Source

pub fn set_phase2(&mut self, val: RingPhase2)

Sets the phase2 value.

Source

pub const fn seq1(&self) -> &Atomic

Gets a reference to the first sequence value.

Source

pub fn load_seq1(&self) -> Uint

Gets the first sequence value.

Source

pub fn set_seq1(&self, val: Uint)

Sets the first sequence value.

Source

pub const fn tail(&self) -> &Atomic

Gets a reference to the tail value.

Source

pub fn load_tail(&self) -> Uint

Gets the tail value.

Source

pub fn set_tail(&self, val: Uint)

Sets the tail value.

Source

pub const fn init_tail(&self) -> &Atomic

Gets a reference the init tail value.

Source

pub fn load_init_tail(&self) -> Uint

Gets the init tail value.

Source

pub fn set_init_tail(&self, val: Uint)

Sets the init tail value.

Source

pub const fn head(&self) -> &Atomic

Gets a reference to the head value.

Source

pub fn load_head(&self) -> Uint

Gets a reference to the head value.

Source

pub fn set_head(&self, val: Uint)

Sets the head value.

Source

pub const fn init_head(&self) -> &Atomic

Gets a reference to the init head value.

Source

pub fn load_init_head(&self) -> Uint

Gets the init head value.

Source

pub fn set_init_head(&self, val: Uint)

Sets the init head value.

Source

pub fn eidx(&self) -> &AtomicUsize

Gets a reference to the enqueue index value.

Source

pub fn load_eidx(&self) -> usize

Gets enqueue index value.

Source

pub fn set_eidx(&self, val: usize)

Sets the enqueue index value.

Source

pub const fn seq2(&self) -> &Atomic

Gets a reference to the second sequence value.

Source

pub fn load_seq2(&self) -> Uint

Gets the second sequence value.

Source

pub fn set_seq2(&self, val: Uint)

Sets the second sequence value.

Source

pub fn thread_id(&self) -> &AtomicUsize

Gets a reference to the thread ID value.

Source

pub fn load_thread_id(&self) -> usize

Gets thread ID value.

Source

pub fn set_thread_id(&self, val: usize)

Sets the thread ID value.

Trait Implementations§

Source§

impl Debug for RingState

Source§

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

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

impl Default for RingState

Source§

fn default() -> Self

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

impl PartialEq for RingState

Source§

fn eq(&self, oth: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

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

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.