Struct AtomicExecutorStatus

Source
pub struct AtomicExecutorStatus(/* private fields */);
Expand description

A wrapper around ExecutorStatus which can be safely shared between threads.

This type uses an AtomicUsize to store the enum value.

Implementations§

Source§

impl AtomicExecutorStatus

Source

pub const fn new(v: ExecutorStatus) -> AtomicExecutorStatus

Creates a new atomic ExecutorStatus.

Source

pub fn into_inner(self) -> ExecutorStatus

Consumes the atomic and returns the contained value.

This is safe because passing self by value guarantees that no other threads are concurrently accessing the atomic data.

Source

pub fn set(&mut self, v: ExecutorStatus)

Sets the value of the atomic without performing an atomic operation.

This is safe because the mutable reference guarantees that no other threads are concurrently accessing the atomic data.

Source

pub fn get(&mut self) -> ExecutorStatus

Gets the value of the atomic without performing an atomic operation.

This is safe because the mutable reference guarantees that no other threads are concurrently accessing the atomic data.

Source

pub fn swap_mut(&mut self, v: ExecutorStatus) -> ExecutorStatus

Stores a value into the atomic, returning the previous value, without performing an atomic operation.

This is safe because the mutable reference guarantees that no other threads are concurrently accessing the atomic data.

Source

pub fn load(&self, order: Ordering) -> ExecutorStatus

Loads a value from the atomic.

load takes an Ordering argument which describes the memory ordering of this operation. Possible values are SeqCst, Acquire and Relaxed.

§Panics

Panics if order is Release or AcqRel.

Source

pub fn store(&self, val: ExecutorStatus, order: Ordering)

Stores a value into the atomic.

store takes an Ordering argument which describes the memory ordering of this operation. Possible values are SeqCst, Release and Relaxed.

§Panics

Panics if order is Acquire or AcqRel.

Source§

impl AtomicExecutorStatus

Source

pub fn swap(&self, val: ExecutorStatus, order: Ordering) -> ExecutorStatus

Stores a value into the atomic, returning the previous value.

swap takes an Ordering argument which describes the memory ordering of this operation. All ordering modes are possible. Note that using Acquire makes the store part of this operation Relaxed, and using Release makes the load part Relaxed.

Source

pub fn compare_and_swap( &self, current: ExecutorStatus, new: ExecutorStatus, order: Ordering, ) -> ExecutorStatus

👎Deprecated: Use compare_exchange or compare_exchange_weak instead

Stores a value into the atomic if the current value is the same as the current value.

The return value is always the previous value. If it is equal to current, then the value was updated.

compare_and_swap also takes an Ordering argument which describes the memory ordering of this operation. Notice that even when using AcqRel, the operation might fail and hence just perform an Acquire load, but not have Release semantics. Using Acquire makes the store part of this operation Relaxed if it happens, and using Release makes the load part Relaxed.

Source

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

Stores a value into the atomic if the current value is the same as the current value.

The return value is a result indicating whether the new value was written and containing the previous value. On success this value is guaranteed to be equal to current.

compare_exchange takes two Ordering arguments to describe the memory ordering of this operation. The first describes the required ordering if the operation succeeds while the second describes the required ordering when the operation fails. Using Acquire as success ordering makes the store part of this operation Relaxed, and using Release makes the successful load Relaxed. The failure ordering can only be SeqCst, Acquire or Relaxed and must be equivalent to or weaker than the success ordering.

Source

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

Stores a value into the atomic if the current value is the same as the current value.

Unlike compare_exchange, this function is allowed to spuriously fail even when the comparison succeeds, which can result in more efficient code on some platforms. The return value is a result indicating whether the new value was written and containing the previous value.

compare_exchange_weak takes two Ordering arguments to describe the memory ordering of this operation. The first describes the required ordering if the operation succeeds while the second describes the required ordering when the operation fails. Using Acquire as success ordering makes the store part of this operation Relaxed, and using Release makes the successful load Relaxed. The failure ordering can only be SeqCst, Acquire or Relaxed and must be equivalent to or weaker than the success ordering.

Trait Implementations§

Source§

impl Debug for AtomicExecutorStatus

Source§

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

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

impl From<ExecutorStatus> for AtomicExecutorStatus

Source§

fn from(val: ExecutorStatus) -> AtomicExecutorStatus

Converts to this type from the input type.

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Erased for T