NSLock
extension NSLock
-
Locks the lock, executes the
blockand unlocks the lock returning the value from theblock.Example
let lock = NSLock() let counter = 0 DispatchQueue.concurrentPerform(iterations: 100) { _ in lock { counter += 1 } }Declaration
Swift
public func callAsFunction<ReturnValue>(_ block: () throws -> ReturnValue) rethrows -> ReturnValue
Install in Dash
NSLock Extension Reference