File tree Expand file tree Collapse file tree 6 files changed +22
-36
lines changed Expand file tree Collapse file tree 6 files changed +22
-36
lines changed Original file line number Diff line number Diff line change @@ -14,15 +14,6 @@ import Foundation
1414
1515import struct TSCBasic. AbsolutePath
1616
17- extension NSLock {
18- /// NOTE: Keep in sync with SwiftPM's 'Sources/Basics/NSLock+Extensions.swift'
19- internal func withLock< T> ( _ body: ( ) throws -> T ) rethrows -> T {
20- lock ( )
21- defer { unlock ( ) }
22- return try body ( )
23- }
24- }
25-
2617/// The set of known SourceKitD instances, uniqued by path.
2718///
2819/// It is not generally safe to have two instances of SourceKitD for the same libsourcekitd, so
Original file line number Diff line number Diff line change @@ -24,15 +24,6 @@ import struct TSCBasic.AbsolutePath
2424import WinSDK
2525#endif
2626
27- extension NSLock {
28- /// NOTE: Keep in sync with SwiftPM's 'Sources/Basics/NSLock+Extensions.swift'
29- fileprivate func withLock< T> ( _ body: ( ) throws -> T ) rethrows -> T {
30- lock ( )
31- defer { unlock ( ) }
32- return try body ( )
33- }
34- }
35-
3627/// A thin wrapper over a connection to a clangd server providing build setting handling.
3728///
3829/// In addition, it also intercepts notifications and replies from clangd in order to do things
Original file line number Diff line number Diff line change @@ -26,15 +26,6 @@ extension Task: AnyTask {
2626 }
2727}
2828
29- fileprivate extension NSLock {
30- /// NOTE: Keep in sync with SwiftPM's 'Sources/Basics/NSLock+Extensions.swift'
31- func withLock< T> ( _ body: ( ) throws -> T ) rethrows -> T {
32- lock ( )
33- defer { unlock ( ) }
34- return try body ( )
35- }
36- }
37-
3829/// A type that is able to track dependencies between tasks.
3930public protocol DependencyTracker : Sendable {
4031 /// Whether the task described by `self` needs to finish executing before
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ add_library(SwiftExtensions STATIC
44 AsyncUtils.swift
55 Collection+Only.swift
66 Collection+PartitionIntoBatches.swift
7+ NSLock+WithLock.swift
78 Sequence+AsyncMap.swift
89 Task+WithPriorityChangedHandler.swift
910 ThreadSafeBox.swift
Original file line number Diff line number Diff line change 1+ //===----------------------------------------------------------------------===//
2+ //
3+ // This source file is part of the Swift.org open source project
4+ //
5+ // Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
6+ // Licensed under Apache License v2.0 with Runtime Library Exception
7+ //
8+ // See https://swift.org/LICENSE.txt for license information
9+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+ //
11+ //===----------------------------------------------------------------------===//
12+
13+ import Foundation
14+
15+ extension NSLock {
16+ func withLock< T> ( _ body: ( ) throws -> T ) rethrows -> T {
17+ lock ( )
18+ defer { unlock ( ) }
19+ return try body ( )
20+ }
21+ }
Original file line number Diff line number Diff line change 1212
1313import Foundation
1414
15- extension NSLock {
16- /// NOTE: Keep in sync with SwiftPM's 'Sources/Basics/NSLock+Extensions.swift'
17- fileprivate func withLock< T> ( _ body: ( ) throws -> T ) rethrows -> T {
18- lock ( )
19- defer { unlock ( ) }
20- return try body ( )
21- }
22- }
23-
2415/// A thread safe container that contains a value of type `T`.
2516///
2617/// - Note: Unchecked sendable conformance because value is guarded by a lock.
You can’t perform that action at this time.
0 commit comments