ConditionMutexProtocol
public protocol ConditionMutexProtocol : MutexProtocol
Allows for waiting until a given condition is satisifed.
-
lockWhen(_:Default implementation) Locks
selfwhenpredicatereturns true.Must be called when
selfis not locked by the current thread of execution.Default Implementation
Declaration
Swift
func lockWhen(_ predicate: () -> Bool)Parameters
predicateA function that returns
truewhen the lock should be locked by the current thread of execution.predicateis 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
selfuntilpredicatereturnstrue.Must be called when
selfis locked by the current thread of execution.Declaration
Swift
func await(_ predicate: () -> Bool)Parameters
predicateA function that returns
truewhenselfshould be locked by the current thread of execution.predicateis only executed while holding the lock.
View on GitHub
ConditionMutexProtocol Protocol Reference