Add AsyncBarrier.SignalAndWait(CancellationToken) overload#1330
Add AsyncBarrier.SignalAndWait(CancellationToken) overload#1330AArnott merged 1 commit intomicrosoft:mainfrom
AsyncBarrier.SignalAndWait(CancellationToken) overload#1330Conversation
Also optimize the pre-existing code. The new overload returns `ValueTask` to leave open the option of optimizing to zero-allocation use via `IValueTaskSource`.
There was a problem hiding this comment.
The PR looks good to me. It is interesting that we defined the signature of the new method to return ValueTask, instead of Task, which seems to make two overloads to have different return types, while it doesn't really save any memory allocation in this case, because we either return Task.CompletedTask or a TaskCompletionSource is always created in the implementation. Do we really have a strong reason to adopt ValueTask to make the two overloads different here?
Yielding |
Also optimize the pre-existing code.
The new overload returns
ValueTaskto leave open the option of optimizing to zero-allocation use viaIValueTaskSource.Closes #1329