Skip to content

Commit 7ddba5e

Browse files
authored
replace tcs blocking task method call (#400)
1 parent 4932e4c commit 7ddba5e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

BitFaster.Caching.UnitTests/Scheduler/BackgroundSchedulerTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ public async Task WhenWorkThrowsLastExceptionIsPopulated()
6868
[Fact]
6969
public void WhenBacklogExceededTasksAreDropped()
7070
{
71-
var tcs = new TaskCompletionSource<bool>();
71+
var mre = new ManualResetEvent(false);
7272

7373
for (int i = 0; i < BackgroundThreadScheduler.MaxBacklog * 2; i++)
7474
{
75-
scheduler.Run(() => { tcs.Task.Wait(); });
75+
scheduler.Run(() => { mre.WaitOne(); });
7676
}
7777

78-
tcs.SetResult(true);
78+
mre.Set();
7979

8080
scheduler.RunCount.Should().BeCloseTo(BackgroundThreadScheduler.MaxBacklog, 1);
8181
}

0 commit comments

Comments
 (0)