pub(crate) struct AtomicEpoch {
data: AtomicUsize,
}Expand description
An atomic value that holds an Epoch.
Fields§
§data: AtomicUsizeSince Epoch is just a wrapper around usize, an AtomicEpoch is similarly represented
using an AtomicUsize.
Implementations§
Source§impl AtomicEpoch
impl AtomicEpoch
Sourcepub(crate) fn compare_exchange(
&self,
current: Epoch,
new: Epoch,
success: Ordering,
failure: Ordering,
) -> Result<Epoch, Epoch>
pub(crate) fn compare_exchange( &self, current: Epoch, new: Epoch, success: Ordering, failure: Ordering, ) -> Result<Epoch, Epoch>
Stores a value into the atomic epoch if the current value is the same as current.
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.
This method takes two Ordering arguments to describe the memory
ordering of this operation. success describes the required ordering for the
read-modify-write operation that takes place if the comparison with current succeeds.
failure describes the required ordering for the load operation that takes place when
the comparison 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.