Skip to content

Commit

Permalink
Enable async for test wait signals (#111)
Browse files Browse the repository at this point in the history
Make TaskCompletionSource used in wait signals run completions
asynchronously to avoid potential deadlocks during test runs.
  • Loading branch information
mtmk authored Aug 11, 2023
1 parent 638e2d3 commit 31797cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/NATS.Client.TestUtilities/WaitSignal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -106,7 +106,7 @@ public WaitSignal(TimeSpan timeout, int count = 1)
{
_timeout = timeout;
_count = count;
_tcs = new TaskCompletionSource<T>();
_tcs = new TaskCompletionSource<T>(TaskCreationOptions.RunContinuationsAsynchronously);
}

public TimeSpan Timeout => _timeout;
Expand Down

0 comments on commit 31797cf

Please sign in to comment.