Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.Testing.Extensions.VSTestBridge.Helpers;
/// </summary>
internal static class SynchronousAwaiter
{
public static void Await(this Task valueTask, bool busyWait = true)
public static void Await(this Task valueTask, bool busyWait = false)
{
if (busyWait)
{
Expand All @@ -23,6 +23,12 @@ public static void Await(this Task valueTask, bool busyWait = true)
}
else
{
// GetAwaiter().GetResult() blocks the calling thread the same way spinning does (both
// keep this thread from returning to the producer until the task completes), but it parks
// the thread on a kernel wait handle instead of burning CPU polling IsCompleted. Every call
// site here is invoked once per test start/end or per discovered test case, so for large
// suites the busy-wait default used to hold a core pegged for no measurable latency benefit
// whenever the awaited publish involved any real (even inline-blocking-consumer) work.
Comment thread
Copilot marked this conversation as resolved.
Resolved
valueTask.GetAwaiter().GetResult();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#nullable enable
*REMOVED*static Microsoft.Testing.Extensions.VSTestBridge.Helpers.SynchronousAwaiter.Await(this System.Threading.Tasks.Task! valueTask, bool busyWait = true) -> void
static Microsoft.Testing.Extensions.VSTestBridge.Helpers.SynchronousAwaiter.Await(this System.Threading.Tasks.Task! valueTask, bool busyWait = false) -> void
Loading