Skip to main content

SharedAtomicU32

Struct SharedAtomicU32 

Source
pub struct SharedAtomicU32 { /* private fields */ }

Implementations§

Source§

impl SharedAtomicU32

Source

pub fn create( path: impl AsRef<Path>, init: u32, ) -> Result<Self, SharedAtomicError>

Obtain the atomic at path, initializing it to init if the path does not yet exist and attaching to it if it does. Attaching leaves the live value in place; init is then unused. A region built for a different width is a LayoutMismatch. reset reinitializes.

Source

pub fn reset( path: impl AsRef<Path>, init: u32, ) -> Result<Self, SharedAtomicError>

Truncate the atomic at path and initialize it to init, discarding the value a live peer holds. For a caller that knows it owns the path.

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, SharedAtomicError>

Source

pub fn load(&self, ord: Ordering) -> u32

Source

pub fn store(&self, v: u32, ord: Ordering)

Source

pub fn fetch_add(&self, v: u32, ord: Ordering) -> u32

Source

pub fn fetch_sub(&self, v: u32, ord: Ordering) -> u32

Source

pub fn fetch_or(&self, v: u32, ord: Ordering) -> u32

Source

pub fn fetch_and(&self, v: u32, ord: Ordering) -> u32

Source

pub fn fetch_xor(&self, v: u32, ord: Ordering) -> u32

Source

pub fn swap(&self, v: u32, ord: Ordering) -> u32

Source

pub fn compare_exchange( &self, current: u32, new: u32, success: Ordering, failure: Ordering, ) -> Result<u32, u32>

Source

pub fn flush(&self) -> Result<(), SharedAtomicError>

Source

pub fn flush_async(&self) -> Result<(), SharedAtomicError>

Non-blocking flush: schedules a writeback via the OS (msync(MS_ASYNC) on Linux; FlushViewOfFile without FlushFileBuffers on Windows). Note: Windows is only partially async (sync to page cache, not to disk).

Trait Implementations§

Source§

impl AdaptiveInstance for SharedAtomicU32

Source§

fn header(&self) -> &HandshakeHeader

Source§

fn ring(&self) -> &ObservationRing

Source§

fn make_policy(&self) -> Box<dyn Policy>

Source§

fn apply_migration(&self, new_tag: u32)

Called by the sidecar when the policy returns a new strategy tag. Default implementation: just set the tag on the header. Primitives that need heavier migration (data-layout swap) override this to perform the swap before (or after) updating the tag.
Source§

impl Send for SharedAtomicU32

Source§

impl Sync for SharedAtomicU32

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.