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
14
14
15
15
import struct TSCBasic. AbsolutePath
16
16
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
-
26
17
/// The set of known SourceKitD instances, uniqued by path.
27
18
///
28
19
/// 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
24
24
import WinSDK
25
25
#endif
26
26
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
-
36
27
/// A thin wrapper over a connection to a clangd server providing build setting handling.
37
28
///
38
29
/// 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 {
26
26
}
27
27
}
28
28
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
-
38
29
/// A type that is able to track dependencies between tasks.
39
30
public protocol DependencyTracker : Sendable {
40
31
/// 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
4
4
AsyncUtils.swift
5
5
Collection+Only.swift
6
6
Collection+PartitionIntoBatches.swift
7
+ NSLock+WithLock.swift
7
8
Sequence+AsyncMap.swift
8
9
Task+WithPriorityChangedHandler.swift
9
10
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 12
12
13
13
import Foundation
14
14
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
-
24
15
/// A thread safe container that contains a value of type `T`.
25
16
///
26
17
/// - Note: Unchecked sendable conformance because value is guarded by a lock.
You can’t perform that action at this time.
0 commit comments