Skip to content

Commit a6e175c

Browse files
committed
threadsafe events collection
1 parent a88665c commit a6e175c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ let tap f x = f x; x
1515

1616
let internal record (cache: AsyncMemoize<_,_,_>) =
1717

18-
let events = ResizeArray()
18+
let events = Collections.Concurrent.ConcurrentQueue()
1919

2020
let waitForIdle() = SpinWait.SpinUntil(fun () -> not cache.Updating)
2121

2222
waitForIdle()
2323
cache.Event
2424
|> Event.map (fun (e, (_, k, _)) -> e, k)
25-
|> Event.add events.Add
25+
|> Event.add events.Enqueue
2626

2727
let getEvents () =
2828
waitForIdle()

tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let fileName fileId = $"File%s{fileId}.fs"
3131

3232
let internal recordAllEvents groupBy =
3333
let mutable cache : AsyncMemoize<_,_,_> option = None
34-
let events = ResizeArray()
34+
let events = ConcurrentQueue()
3535

3636
let waitForIdle() = SpinWait.SpinUntil(fun () -> not cache.Value.Updating)
3737

@@ -40,7 +40,7 @@ let internal recordAllEvents groupBy =
4040
waitForIdle()
4141
cache.Value.Event
4242
|> Event.map (fun (e, k) -> groupBy k, e)
43-
|> Event.add events.Add
43+
|> Event.add events.Enqueue
4444

4545
let getEvents () =
4646
waitForIdle()

0 commit comments

Comments
 (0)