UnfairLock
public final class UnfairLock : LockingProtocol
Low-level lock that allows waiters to block efficiently on contention.
There is no attempt at fairness or lock ordering, e.g. an unlocker can potentially immediately reacquire the lock before a woken up waiter gets an opportunity to attempt to acquire the lock. This may be advantageous for performance reasons, but also makes starvation of waiters a possibility.
Backed by os_unfair_lock
.
-
Declaration
Swift
@inlinable public init()
-
Declaration
Swift
@inlinable public func tryAcquire() -> Bool
-
Declaration
Swift
@inlinable public func acquire()
-
Declaration
Swift
@inlinable public func release()