@@ -22,18 +22,18 @@ public protocol NSLocking {
22
22
}
23
23
24
24
#if CYGWIN
25
- private typealias _PthreadMutexPointer = UnsafeMutablePointer < pthread_mutex_t ? >
26
- private typealias _PthreadCondPointer = UnsafeMutablePointer < pthread_cond_t ? >
25
+ private typealias _MutexPointer = UnsafeMutablePointer < pthread_mutex_t ? >
26
+ private typealias _ConditionVariablePointer = UnsafeMutablePointer < pthread_cond_t ? >
27
27
#else
28
- private typealias _PthreadMutexPointer = UnsafeMutablePointer < pthread_mutex_t >
29
- private typealias _PthreadCondPointer = UnsafeMutablePointer < pthread_cond_t >
28
+ private typealias _MutexPointer = UnsafeMutablePointer < pthread_mutex_t >
29
+ private typealias _ConditionVariablePointer = UnsafeMutablePointer < pthread_cond_t >
30
30
#endif
31
31
32
32
open class NSLock : NSObject , NSLocking {
33
- internal var mutex = _PthreadMutexPointer . allocate ( capacity: 1 )
33
+ internal var mutex = _MutexPointer . allocate ( capacity: 1 )
34
34
#if os(macOS) || os(iOS)
35
- private var timeoutCond = _PthreadCondPointer . allocate ( capacity: 1 )
36
- private var timeoutMutex = _PthreadMutexPointer . allocate ( capacity: 1 )
35
+ private var timeoutCond = _ConditionVariablePointer . allocate ( capacity: 1 )
36
+ private var timeoutMutex = _MutexPointer . allocate ( capacity: 1 )
37
37
#endif
38
38
39
39
public override init ( ) {
@@ -175,10 +175,10 @@ open class NSConditionLock : NSObject, NSLocking {
175
175
}
176
176
177
177
open class NSRecursiveLock : NSObject , NSLocking {
178
- internal var mutex = _PthreadMutexPointer . allocate ( capacity: 1 )
178
+ internal var mutex = _MutexPointer . allocate ( capacity: 1 )
179
179
#if os(macOS) || os(iOS)
180
- private var timeoutCond = _PthreadCondPointer . allocate ( capacity: 1 )
181
- private var timeoutMutex = _PthreadMutexPointer . allocate ( capacity: 1 )
180
+ private var timeoutCond = _ConditionVariablePointer . allocate ( capacity: 1 )
181
+ private var timeoutMutex = _MutexPointer . allocate ( capacity: 1 )
182
182
#endif
183
183
184
184
public override init ( ) {
@@ -240,8 +240,8 @@ open class NSRecursiveLock: NSObject, NSLocking {
240
240
}
241
241
242
242
open class NSCondition : NSObject , NSLocking {
243
- internal var mutex = _PthreadMutexPointer . allocate ( capacity: 1 )
244
- internal var cond = _PthreadCondPointer . allocate ( capacity: 1 )
243
+ internal var mutex = _MutexPointer . allocate ( capacity: 1 )
244
+ internal var cond = _ConditionVariablePointer . allocate ( capacity: 1 )
245
245
246
246
public override init ( ) {
247
247
pthread_mutex_init ( mutex, nil )
@@ -301,7 +301,7 @@ private func timeSpecFrom(date: Date) -> timespec? {
301
301
302
302
#if os(macOS) || os(iOS)
303
303
304
- private func deallocateTimedLockData( cond: _PthreadCondPointer , mutex: _PthreadMutexPointer ) {
304
+ private func deallocateTimedLockData( cond: _ConditionVariablePointer , mutex: _MutexPointer ) {
305
305
pthread_cond_destroy ( cond)
306
306
cond. deinitialize ( count: 1 )
307
307
cond. deallocate ( )
@@ -314,9 +314,9 @@ private func deallocateTimedLockData(cond: _PthreadCondPointer, mutex: _PthreadM
314
314
// Emulate pthread_mutex_timedlock using pthread_cond_timedwait.
315
315
// lock(before:) passes a condition variable/mutex pair to use.
316
316
// unlock() will use pthread_cond_broadcast() to wake any waits in progress.
317
- private func timedLock( mutex: _PthreadMutexPointer , endTime: Date ,
318
- using timeoutCond: _PthreadCondPointer ,
319
- with timeoutMutex: _PthreadMutexPointer ) -> Bool {
317
+ private func timedLock( mutex: _MutexPointer , endTime: Date ,
318
+ using timeoutCond: _ConditionVariablePointer ,
319
+ with timeoutMutex: _MutexPointer ) -> Bool {
320
320
321
321
var timeSpec = timeSpecFrom ( date: endTime)
322
322
while var ts = timeSpec {
0 commit comments