File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 10
10
//
11
11
//===----------------------------------------------------------------------===//
12
12
13
+ import class Foundation. NSLock
13
14
import TSCBasic
14
15
@_implementationOnly import Yams
15
16
@@ -25,7 +26,7 @@ public final class ArgsResolver {
25
26
// FIXME: We probably need a dedicated type for this...
26
27
private let temporaryDirectory : VirtualPath
27
28
28
- private let lock = Lock ( )
29
+ private let lock = NSLock ( )
29
30
30
31
public init ( fileSystem: FileSystem , temporaryDirectory: VirtualPath ? = nil ) throws {
31
32
self . pathMapping = [ : ]
@@ -202,3 +203,13 @@ public final class ArgsResolver {
202
203
}
203
204
}
204
205
}
206
+
207
+ fileprivate extension NSLock {
208
+ /// NOTE: Keep in sync with SwiftPM's 'Sources/Basics/NSLock+Extensions.swift'
209
+ /// Execute the given block while holding the lock.
210
+ func withLock< T> ( _ body: ( ) throws -> T ) rethrows -> T {
211
+ lock ( )
212
+ defer { unlock ( ) }
213
+ return try body ( )
214
+ }
215
+ }
Original file line number Diff line number Diff line change @@ -63,9 +63,6 @@ internal final class SwiftScan {
63
63
/// The handle to the dylib.
64
64
let dylib : Loader . Handle
65
65
66
- /// Lock protecting private state.
67
- let lock : Lock = Lock ( )
68
-
69
66
/// libSwiftScan API functions.
70
67
let api : swiftscan_functions_t ;
71
68
You can’t perform that action at this time.
0 commit comments