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 all Darwin platforms via OSAllocatedUnfairLock. | |
// Lightweight version of https://github.com/swhitty/swift-mutex | |
// Feel free to use any part of this gist. | |
import struct os.OSAllocatedUnfairLock | |
// Backports the Swift 6.0 Mutex API | |
@available(iOS, introduced: 16.0, deprecated: 18.0, message: "use Mutex from Synchronization module") | |
@available(macOS, introduced: 13.0, deprecated: 15.0, message: "use Mutex from Synchronization module") | |
public struct Mutex<Value: ~Copyable>: @unchecked Sendable, ~Copyable { |