ThreadSafeValueWrapper
public protocol ThreadSafeValueWrapper
Protocol for AtomicKit
thread-safe wrapper objects around a value/type.
-
Required initializer.
Initializes a thread-safe wrapper object with a default value.Declaration
Swift
init( value: ValueType )
-
Atomically gets the value of the wrapped type.
Declaration
Swift
func get() -> ValueType
Return Value
The actual value of the wrapped type.
-
Atomically sets the value of the wrapped type.
Declaration
Swift
func set( _ value: ValueType )
-
Atomically executes a custom closure, receiving the value of the wrapped type.
The passed closure is guaranteed to be executed atomically, in respect of the current value of the wrapped type.
Declaration
Swift
func execute( closure: ( ValueType ) -> Swift.Void )
-
Atomically executes a custom closure, receiving the value of the wrapped type.
The passed closure is guaranteed to be executed atomically, in respect of the current value of the wrapped type.
Declaration
Swift
func execute< R >( closure: ( ValueType ) -> R ) -> R
Return Value
The closure’s return value.