AtomicRepresentation
@frozen struct AtomicRepresentation
@frozen struct AtomicRepresentation
typealias Value
The type whose values this storage representation is representing.
init(Int.AtomicRepresentation.Value)
Encode the supplied value into its atomic storage representation.
static func atomicCompareExchange(expected: Int.AtomicRepresentation.Value, desired: Int.AtomicRepresentation.Value, at: UnsafeMutablePointer<Int.AtomicRepresentation>, ordering: AtomicUpdateOrdering) -> (exchanged: Bool, original: Int.AtomicRepresentation.Value)
Perform an atomic compare and exchange operation on the value referenced by pointer
, applying the specified memory ordering.
static func atomicCompareExchange(expected: Int.AtomicRepresentation.Value, desired: Int.AtomicRepresentation.Value, at: UnsafeMutablePointer<Int.AtomicRepresentation>, successOrdering: AtomicUpdateOrdering, failureOrdering: AtomicLoadOrdering) -> (exchanged: Bool, original: Int.AtomicRepresentation.Value)
Perform an atomic compare and exchange operation on the value referenced by pointer
, applying the specified success/failure memory orderings.
static func atomicExchange(Int.AtomicRepresentation.Value, at: UnsafeMutablePointer<Int.AtomicRepresentation>, ordering: AtomicUpdateOrdering) -> Int.AtomicRepresentation.Value
Atomically sets the value referenced by pointer
to desired
and returns the original value, applying the specified memory ordering.
static func atomicLoad(at: UnsafeMutablePointer<Int.AtomicRepresentation>, ordering: AtomicLoadOrdering) -> Int.AtomicRepresentation.Value
Atomically loads and returns the value referenced by the given pointer, applying the specified memory ordering.
static func atomicLoadThenBitwiseAnd(with: Int.AtomicRepresentation.Value, at: UnsafeMutablePointer<Int.AtomicRepresentation>, ordering: AtomicUpdateOrdering) -> Int.AtomicRepresentation.Value
Perform an atomic bitwise AND operation on the value referenced by pointer
and return the original value, applying the specified memory ordering.
static func atomicLoadThenBitwiseOr(with: Int.AtomicRepresentation.Value, at: UnsafeMutablePointer<Int.AtomicRepresentation>, ordering: AtomicUpdateOrdering) -> Int.AtomicRepresentation.Value
Perform an atomic bitwise OR operation on the value referenced by pointer
and return the original value, applying the specified memory ordering.
static func atomicLoadThenBitwiseXor(with: Int.AtomicRepresentation.Value, at: UnsafeMutablePointer<Int.AtomicRepresentation>, ordering: AtomicUpdateOrdering) -> Int.AtomicRepresentation.Value
Perform an atomic bitwise XOR operation on the value referenced by pointer
and return the original value, applying the specified memory ordering.
static func atomicLoadThenWrappingDecrement(by: Int.AtomicRepresentation.Value, at: UnsafeMutablePointer<Int.AtomicRepresentation>, ordering: AtomicUpdateOrdering) -> Int.AtomicRepresentation.Value
Perform an atomic wrapping decrement operation on the value referenced by pointer
and return the original value, applying the specified memory ordering.
static func atomicLoadThenWrappingIncrement(by: Int.AtomicRepresentation.Value, at: UnsafeMutablePointer<Int.AtomicRepresentation>, ordering: AtomicUpdateOrdering) -> Int.AtomicRepresentation.Value
Perform an atomic wrapping increment operation on the value referenced by pointer
and return the original value, applying the specified memory ordering.
static func atomicStore(Int.AtomicRepresentation.Value, at: UnsafeMutablePointer<Int.AtomicRepresentation>, ordering: AtomicStoreOrdering)
Atomically sets the value referenced by pointer
to desired
, applying the specified memory ordering.
static func atomicWeakCompareExchange(expected: Int.AtomicRepresentation.Value, desired: Int.AtomicRepresentation.Value, at: UnsafeMutablePointer<Int.AtomicRepresentation>, successOrdering: AtomicUpdateOrdering, failureOrdering: AtomicLoadOrdering) -> (exchanged: Bool, original: Int.AtomicRepresentation.Value)
Perform an atomic weak compare and exchange operation on the value referenced by pointer
, applying the specified success/failure memory orderings. This compare-exchange variant is allowed to spuriously fail; it is designed to be called in a loop until it indicates a successful exchange has happened.
func dispose() -> Int.AtomicRepresentation.Value
Prepare this atomic storage value for deinitialization, extracting the logical value it represents. This invalidates this atomic storage; you must not perform any operations on it after this call (except for deinitialization).