Atomic

Atomic is a class that allows for atomic loading and storing of objects.atomic

var ai = Atomic<Int>(15)
ai += 10
print(ai) // prints 25

There are a number of helper aliases for common types such as IntA, StringA, BoolA

var ai = IntA(15)
ai += 10
print(ai) // prints 25
  • Returns an atomic object.

    Declaration

    Swift

    public init(_ value : T)
  • Loads the value atomically.

    Declaration

    Swift

    public func load() -> T
  • Stores a value atomically.

    Declaration

    Swift

    public func store(value : T)
  • Exchanges / Swaps values atomically.

    Declaration

    Swift

    public func exchange(atomic : Atomic<T>)