@@ -648,6 +648,7 @@ type FrameworkImportsCache(size) =
648
648
lazyWork
649
649
)
650
650
node
651
+
651
652
652
653
/// This function strips the "System" assemblies from the tcConfig and returns a age-cached TcImports for them.
653
654
member this.Get ( tcConfig : TcConfig ) =
@@ -1248,19 +1249,24 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc
1248
1249
let t2 = MaxTimeStampInDependencies state.logicalStampedFileNames fileSlot
1249
1250
max t1 t2
1250
1251
1251
- let gate = obj()
1252
+ let semaphore = new SemaphoreSlim( 1 , 1 )
1253
+
1252
1254
let mutable currentState = state
1253
1255
1254
1256
let setCurrentState state cache ( ct : CancellationToken ) =
1255
- lock gate ( fun () ->
1256
- ct.ThrowIfCancellationRequested()
1257
- currentState <- computeStampedFileNames initialState state cache
1258
- )
1257
+ node {
1258
+ do ! semaphore.WaitAsync( ct) |> NodeCode.AwaitTask
1259
+ try
1260
+ ct.ThrowIfCancellationRequested()
1261
+ currentState <- computeStampedFileNames initialState state cache
1262
+ finally
1263
+ semaphore.Release() |> ignore
1264
+ }
1259
1265
1260
1266
let checkFileTimeStamps ( cache : TimeStampCache ) =
1261
1267
node {
1262
1268
let! ct = NodeCode.CancellationToken
1263
- setCurrentState currentState cache ct
1269
+ do ! setCurrentState currentState cache ct
1264
1270
}
1265
1271
1266
1272
do IncrementalBuilderEventTesting.MRU.Add( IncrementalBuilderEventTesting.IBECreated)
@@ -1443,7 +1449,7 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc
1443
1449
let newState = { currentState with notifiedStampedFileNames = currentState.notifiedStampedFileNames.SetItem( slotOfFile, timeStamp) }
1444
1450
let cache = TimeStampCache defaultTimeStamp
1445
1451
let! ct = NodeCode.CancellationToken
1446
- setCurrentState newState cache ct
1452
+ do ! setCurrentState newState cache ct
1447
1453
}
1448
1454
1449
1455
member _.SourceFiles = fileNames |> Seq.map ( fun f -> f.Source.FilePath) |> List.ofSeq
0 commit comments