Concurrency Concerns in C#

Dated Sep 22, 2026; last modified on Thu, 24 Sep 2026

Cancellation

Sourced from . Notes

  1. ✅ Overview: cooperative cancellation; the 90% case; the cancellation contract; exceptions to the “90% case”
  2. ✅ Requesting Cancellation: CancellationTokenSource; timeouts; manual cancellation; cancelling and disposing
  3. ✅ Detecting Cancellation: responding to cancellation; TaskCanceledException; OperationCanceledException.CancellationToken
  4. ✅ Polling: how to poll; how not to poll; when to poll
  5. ✅ Registration: how to register; a race condition; cleanup is important; synchronous cancellation callbacks
  6. ✅ Linking: linked cancellation tokens; use cases; don’t use OperationCanceledException.CancellationToken

References

  1. Cancellation, Part 1: Overview. Stephen Cleary. blog.stephencleary.com . Accessed Sep 22, 2026.