Coordination Primitives
-
A variant lock backed by a platform type that attempts to allow waiters to block efficiently on contention. This locking type behaves the same for both read and write locks.
- On recent versions of Darwin (iOS 10.0, macOS 12.0, tvOS 1.0, watchOS 3.0, or better), this efficiency is a guarantee.
- On Linux, BSD, or Android, waiters perform comparably to a kernel lock under contention.
Declaration
Swift
public final class NativeLock : Locking
-
A readers-writer lock provided by the platform implementation of the POSIX Threads standard. Read more: https://en.wikipedia.org/wiki/POSIX_Threads
See moreDeclaration
Swift
public final class POSIXReadWriteLock : Locking
-
A locking construct using a counting semaphore from Grand Central Dispatch. This locking type behaves the same for both read and write locks.
The semaphore lock performs comparably to a spinlock under little lock contention, and comparably to a platform lock under contention.
See moreDeclaration
Swift
extension DispatchSemaphore: Locking