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
blockThe mutating block
-
Creates an instance with the provided parameters.
Declaration
Swift
public init(_ value: T, label: String? = nil, qualityOfService: DispatchQoS = .utility)Parameters
valueThe value to wrap
labelThe label for the underlying queue
queueThe underlying queue
Return Value
The instance
View on GitHub
Install in Dash
ReadWriteLock Class Reference