Skip to content

Use CancellationTokenSource.CancelAsync with a compatibility shim - #284

Open
Solution-lab wants to merge 1 commit into
madelson:masterfrom
Solution-lab:fix/265-cancel-async
Open

Use CancellationTokenSource.CancelAsync with a compatibility shim#284
Solution-lab wants to merge 1 commit into
madelson:masterfrom
Solution-lab:fix/265-cancel-async

Conversation

@Solution-lab

Copy link
Copy Markdown

Fixes #265.

  • Adds a CancellationTokenSource.CancelAsync() compatibility shim for frameworks older than .NET 8.
  • Uses the native CancelAsync() implementation on .NET 8.
  • Replaces background Task.Run(() => cts.Cancel()) calls with CancelAsync().
  • Adds a test verifying that cancellation does not block on callbacks.

Tested on .NET 8 and .NET Framework 4.7.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make a shim for CancelAsync() and leverage that in places

1 participant