Shims OSAllocatedUnfairLock in a
struct AllocatedUnfairLock
for the following platforms:
- .macOS 10.15+
- .iOS 13+
- .tvOS 13+
- .watchOS 6+
This package might also be of use when Swift 6's Mutex is unavailable.
.package(url: "https://github.com/Akazm/allocated-unfair-lock", from: "1.2.0")
import AllocatedUnfairLockShim
let myLock: AllocatedUnfairLock<Int> = AllocatedUnfairLock(initialState: 20)
/*
Happy locking on older platforms!
For API reference, see https://developer.apple.com/documentation/os/osallocatedunfairlock
*/
AllocatedUnfairLock
automatically falls back to lower level C-APIs
(os_unfair_lock et. al) in case the requirements for
OSAllocatedUnfairLock
are not satisfied for your current target.