Skip to content

Commit 44c7137

Browse files
authored
Merge pull request swiftlang#4944 from maartene/main
add Sendable conformance to NSLock
2 parents 77af9c5 + cb9bd9d commit 44c7137

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/Foundation/NSLock.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private typealias _RecursiveMutexPointer = UnsafeMutablePointer<pthread_mutex_t>
4949
private typealias _ConditionVariablePointer = UnsafeMutablePointer<pthread_cond_t>
5050
#endif
5151

52-
open class NSLock: NSObject, NSLocking {
52+
open class NSLock: NSObject, NSLocking, @unchecked Sendable {
5353
internal var mutex = _MutexPointer.allocate(capacity: 1)
5454
#if os(macOS) || os(iOS) || os(Windows)
5555
private var timeoutCond = _ConditionVariablePointer.allocate(capacity: 1)
@@ -165,7 +165,7 @@ extension NSLock {
165165
}
166166

167167
#if SWIFT_CORELIBS_FOUNDATION_HAS_THREADS
168-
open class NSConditionLock : NSObject, NSLocking {
168+
open class NSConditionLock : NSObject, NSLocking, @unchecked Sendable {
169169
internal var _cond = NSCondition()
170170
internal var _value: Int
171171
internal var _thread: _swift_CFThreadRef?
@@ -259,7 +259,7 @@ open class NSConditionLock : NSObject, NSLocking {
259259
}
260260
#endif
261261

262-
open class NSRecursiveLock: NSObject, NSLocking {
262+
open class NSRecursiveLock: NSObject, NSLocking, @unchecked Sendable {
263263
internal var mutex = _RecursiveMutexPointer.allocate(capacity: 1)
264264
#if os(macOS) || os(iOS) || os(Windows)
265265
private var timeoutCond = _ConditionVariablePointer.allocate(capacity: 1)
@@ -381,7 +381,7 @@ open class NSRecursiveLock: NSObject, NSLocking {
381381
open var name: String?
382382
}
383383

384-
open class NSCondition: NSObject, NSLocking {
384+
open class NSCondition: NSObject, NSLocking, @unchecked Sendable {
385385
internal var mutex = _MutexPointer.allocate(capacity: 1)
386386
internal var cond = _ConditionVariablePointer.allocate(capacity: 1)
387387

0 commit comments

Comments
 (0)