LockingProtocol

public protocol LockingProtocol : AnyObject
  • Attempts to acquire the lock without blocking a thread’s execution and returns a Boolean value that indicates whether the attempt was successful.

    Declaration

    Swift

    func tryAcquire() -> Bool
  • Attempts to acquire the lock, blocking a thread’s execution until the lock can be acquired.

    Declaration

    Swift

    func acquire()
  • Relinquishes a previously acquired lock.

    Declaration

    Swift

    func release()
  • sync(_:) Extension method

    Declaration

    Swift

    public func sync<R>(_ fn: () throws -> R) rethrows -> R
  • trySync(_:) Extension method

    Declaration

    Swift

    public func trySync<R>(_ fn: () throws -> R) rethrows -> R?