@@ -238,7 +238,7 @@ public struct LocalTestingDistributedActorSystemError: DistributedActorSystemErr
238238@available ( SwiftStdlib 5 . 7 , * )
239239@safe
240240fileprivate class _Lock {
241- #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
241+ #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)
242242 private let underlying : UnsafeMutablePointer < os_unfair_lock >
243243 #elseif os(Windows)
244244 private let underlying : UnsafeMutablePointer < SRWLOCK >
@@ -251,7 +251,7 @@ fileprivate class _Lock {
251251 #endif
252252
253253 init ( ) {
254- #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
254+ #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)
255255 self . underlying = UnsafeMutablePointer . allocate ( capacity: 1 )
256256 unsafe self. underlying . initialize ( to: os_unfair_lock ( ) )
257257 #elseif os(Windows)
@@ -261,21 +261,21 @@ fileprivate class _Lock {
261261 // WASI environment has only a single thread
262262 #else
263263 self . underlying = UnsafeMutablePointer . allocate ( capacity: 1 )
264- guard pthread_mutex_init ( self . underlying, nil ) == 0 else {
264+ guard unsafe pthread_mutex_init( self . underlying, nil ) == 0 else {
265265 fatalError ( " pthread_mutex_init failed " )
266266 }
267267 #endif
268268 }
269269
270270 deinit {
271- #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
271+ #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)
272272 // `os_unfair_lock`s do not need to be explicitly destroyed
273273 #elseif os(Windows)
274274 // `SRWLOCK`s do not need to be explicitly destroyed
275275 #elseif os(WASI)
276276 // WASI environment has only a single thread
277277 #else
278- guard pthread_mutex_destroy ( self . underlying) == 0 else {
278+ guard unsafe pthread_mutex_destroy( self . underlying) == 0 else {
279279 fatalError ( " pthread_mutex_destroy failed " )
280280 }
281281 #endif
@@ -289,27 +289,27 @@ fileprivate class _Lock {
289289
290290 @discardableResult
291291 func withLock< T> ( _ body: ( ) -> T ) -> T {
292- #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
292+ #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)
293293 unsafe os_unfair_lock_lock( self . underlying)
294294 #elseif os(Windows)
295295 AcquireSRWLockExclusive ( self . underlying)
296296 #elseif os(WASI)
297297 // WASI environment has only a single thread
298298 #else
299- guard pthread_mutex_lock ( self . underlying) == 0 else {
299+ guard unsafe pthread_mutex_lock( self . underlying) == 0 else {
300300 fatalError ( " pthread_mutex_lock failed " )
301301 }
302302 #endif
303303
304304 defer {
305- #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
305+ #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)
306306 unsafe os_unfair_lock_unlock( self . underlying)
307307 #elseif os(Windows)
308308 ReleaseSRWLockExclusive ( self . underlying)
309309 #elseif os(WASI)
310310 // WASI environment has only a single thread
311311 #else
312- guard pthread_mutex_unlock ( self . underlying) == 0 else {
312+ guard unsafe pthread_mutex_unlock( self . underlying) == 0 else {
313313 fatalError ( " pthread_mutex_unlock failed " )
314314 }
315315 #endif
0 commit comments