Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/coverlet.collector/Utilities/CountDownEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,10 @@ public void Signal()

public void Wait()
{
// We wait on another thread to avoid to block forever
// We could use Task/Task.Delay timeout trick but this api and collector are sync so to
// avoid too much GetAwaiter()/GetResult() I prefer keep code simple.
// This thread is created only one time where we pass coverage files
var waitOnThread = new Thread(() => _countDownEvent.Wait());
waitOnThread.Start();
waitOnThread.Join(_waitTimeout);
if (!_countDownEvent.Wait(_waitTimeout))
{
throw new TimeoutException($"CollectorCountdownEvent timeout after {_waitTimeout}");
}
}
}
}