This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Backports the Swift 6 type Mutex<Value> to Swift 5 and all Darwin platforms via OSAllocatedUnfairLock. | |
// Lightweight version of https://github.com/swhitty/swift-mutex | |
// Feel free to use any part of this gist. | |
// Note: ~Copyable are not supported | |
#if compiler(>=6) | |
@available(iOS, introduced: 16.0, deprecated: 18.0, message: "use Mutex from Synchronization module included with Swift 6") | |
@available(macOS, introduced: 13.0, deprecated: 15.0, message: "use Mutex from Synchronization module included with Swift 6") | |
public struct Mutex<Value>: @unchecked Sendable { |