From 31797cf9b183a5ca6336dc6c92a160988ae59925 Mon Sep 17 00:00:00 2001 From: Ziya Suzen Date: Fri, 11 Aug 2023 16:02:46 +0100 Subject: [PATCH] Enable async for test wait signals (#111) Make TaskCompletionSource used in wait signals run completions asynchronously to avoid potential deadlocks during test runs. --- tests/NATS.Client.TestUtilities/WaitSignal.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/NATS.Client.TestUtilities/WaitSignal.cs b/tests/NATS.Client.TestUtilities/WaitSignal.cs index 8ff2acbbf..b5814ba92 100644 --- a/tests/NATS.Client.TestUtilities/WaitSignal.cs +++ b/tests/NATS.Client.TestUtilities/WaitSignal.cs @@ -56,7 +56,7 @@ public WaitSignal(TimeSpan timeout, int count = 1) { _timeout = timeout; _count = count; - _tcs = new TaskCompletionSource(); + _tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); } public TimeSpan Timeout => _timeout; @@ -106,7 +106,7 @@ public WaitSignal(TimeSpan timeout, int count = 1) { _timeout = timeout; _count = count; - _tcs = new TaskCompletionSource(); + _tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); } public TimeSpan Timeout => _timeout;