Add AsyncBarrier.SignalAndWait(CancellationToken) overload - #1330
Conversation
b31aaf6 to
568aed0
Compare
568aed0 to
a131dd1
Compare
Also optimize the pre-existing code. The new overload returns `ValueTask` to leave open the option of optimizing to zero-allocation use via `IValueTaskSource`.
a131dd1 to
c905111
Compare
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