vs-threading icon indicating copy to clipboard operation
vs-threading copied to clipboard

Support cancellation in AsyncBarrier

Open chenzhekl opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

I want to have AsyncBarrier to support cancellation in SignalAndAwait, such that I can free those async functions from awaiting the barrier to finish.

Describe the solution you'd like

Maybe we can have SignalAndAwait accept an CancellationToken as its argument.

Describe alternatives you've considered

None

Additional context

None

chenzhekl avatar Jun 26 '24 04:06 chenzhekl

I'm not sure whether we'll deliver this yet. But in the meantime you can tack on .WithCancellation(ct) on the SignalAndWait call to achieve the same effect that we would probably deliver.

AArnott avatar Jun 26 '24 14:06 AArnott

Thanks! @AArnott . .WithCancellation(ct) works perfect for me as a workaround.

chenzhekl avatar Jun 28 '24 03:06 chenzhekl