ReadWriteLock
public final class ReadWriteLock<T>
Many readers, single writer generic lock.
let myClass = ...
let lock = ReadWriteLock(myClass)
lock.mutate {
// do stuff with $0 to update myClass
}
-
Returns the current value.
Declaration
Swift
public var value: T { get }
-
Mutates the current value within the provided
block
.Declaration
Swift
public func mutate(_ block: @escaping (inout T) -> Void)
Parameters
block
The mutating block
-
Creates an instance with the provided parameters.
Declaration
Swift
public init(_ value: T, label: String? = nil, qualityOfService: DispatchQoS = .utility)
Parameters
value
The value to wrap
label
The label for the underlying queue
queue
The underlying queue
Return Value
The instance