ConditionMutexProtocol

public protocol ConditionMutexProtocol : MutexProtocol

Allows for waiting until a given condition is satisifed.

  • lockWhen(_:) Default implementation

    Locks self when predicate returns true.

    Must be called when self is not locked by the current thread of execution.

    Default Implementation

    Declaration

    Swift

    func lockWhen(_ predicate: () -> Bool)

    Parameters

    predicate

    A function that returns true when the lock should be locked by the current thread of execution. predicate is only executed while holding the lock.

  • lockWhen(_:_:) Default implementation

    Undocumented

    Default Implementation

    Undocumented

    Declaration

    Swift

    func lockWhen<T>(_ predicate: () -> Bool, _ body: () throws -> T) rethrows -> T
  • Unlocks self until predicate returns true.

    Must be called when self is locked by the current thread of execution.

    Declaration

    Swift

    func await(_ predicate: () -> Bool)

    Parameters

    predicate

    A function that returns true when self should be locked by the current thread of execution. predicate is only executed while holding the lock.