Lock
public protocol Lock
A generic interface describing a lock that can be acquired for synchronous (blocking) reading or writing.
-
Describes the underlying locking mechanism used by the receiver.
Declaration
Swift
var mechanism: LockMechanism -
Executes the given function with a read lock held, returning its result.
Declaration
Swift
func read<R>(_ fn: () -> R)Parameters
fnA function to perform while a read lock is held.
Return Value
The result of calling
fn(). -
Executes the given function with the write lock held, returning its result.
Declaration
Swift
func write<R>(_ fn: () -> R)Parameters
fnA function to perform while the write lock is held.
Return Value
The result of calling
fn().
View on GitHub
Lock Protocol Reference