mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Distributed: Add visionOS to Apple platform conditionals.
This commit is contained in:
@@ -238,7 +238,7 @@ public struct LocalTestingDistributedActorSystemError: DistributedActorSystemErr
|
||||
@available(SwiftStdlib 5.7, *)
|
||||
@safe
|
||||
fileprivate class _Lock {
|
||||
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
|
||||
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)
|
||||
private let underlying: UnsafeMutablePointer<os_unfair_lock>
|
||||
#elseif os(Windows)
|
||||
private let underlying: UnsafeMutablePointer<SRWLOCK>
|
||||
@@ -251,7 +251,7 @@ fileprivate class _Lock {
|
||||
#endif
|
||||
|
||||
init() {
|
||||
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
|
||||
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)
|
||||
self.underlying = UnsafeMutablePointer.allocate(capacity: 1)
|
||||
unsafe self.underlying.initialize(to: os_unfair_lock())
|
||||
#elseif os(Windows)
|
||||
@@ -268,7 +268,7 @@ fileprivate class _Lock {
|
||||
}
|
||||
|
||||
deinit {
|
||||
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
|
||||
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)
|
||||
// `os_unfair_lock`s do not need to be explicitly destroyed
|
||||
#elseif os(Windows)
|
||||
// `SRWLOCK`s do not need to be explicitly destroyed
|
||||
@@ -289,7 +289,7 @@ fileprivate class _Lock {
|
||||
|
||||
@discardableResult
|
||||
func withLock<T>(_ body: () -> T) -> T {
|
||||
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
|
||||
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)
|
||||
unsafe os_unfair_lock_lock(self.underlying)
|
||||
#elseif os(Windows)
|
||||
AcquireSRWLockExclusive(self.underlying)
|
||||
@@ -302,7 +302,7 @@ fileprivate class _Lock {
|
||||
#endif
|
||||
|
||||
defer {
|
||||
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
|
||||
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)
|
||||
unsafe os_unfair_lock_unlock(self.underlying)
|
||||
#elseif os(Windows)
|
||||
ReleaseSRWLockExclusive(self.underlying)
|
||||
|
||||
Reference in New Issue
Block a user