File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,17 @@ internal struct Lock {
37
37
#if canImport(Darwin)
38
38
platformLock. initialize ( to: os_unfair_lock ( ) )
39
39
#elseif canImport(Glibc)
40
- precondition ( pthread_mutex_init ( platformLock, nil ) == 0 , " pthread_mutex_init failed " )
40
+ let result = pthread_mutex_init ( platformLock, nil )
41
+ precondition ( result == 0 , " pthread_mutex_init failed " )
41
42
#elseif canImport(WinSDK)
42
43
InitializeSRWLock ( platformLock)
43
44
#endif
44
45
}
45
46
46
47
fileprivate static func deinitialize( _ platformLock: PlatformLock ) {
47
48
#if canImport(Glibc)
48
- precondition ( pthread_mutex_destroy ( platformLock) == 0 , " pthread_mutex_destroy failed " )
49
+ let result = pthread_mutex_destroy ( platformLock)
50
+ precondition ( result == 0 , " pthread_mutex_destroy failed " )
49
51
#endif
50
52
platformLock. deinitialize ( count: 1 )
51
53
}
@@ -64,7 +66,8 @@ internal struct Lock {
64
66
#if canImport(Darwin)
65
67
os_unfair_lock_unlock ( platformLock)
66
68
#elseif canImport(Glibc)
67
- precondition ( pthread_mutex_unlock ( platformLock) == 0 , " pthread_mutex_unlock failed " )
69
+ let result = pthread_mutex_unlock ( platformLock)
70
+ precondition ( result == 0 , " pthread_mutex_unlock failed " )
68
71
#elseif canImport(WinSDK)
69
72
ReleaseSRWLockExclusive ( platformLock)
70
73
#endif
You can’t perform that action at this time.
0 commit comments