Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 2
    Assume we got the following situation: await Task.Delay(5000). When I kill the task I get TaskCanceledException (and suppress it) but my thread is still alive. Neat! :) Commented Jul 1, 2017 at 10:11
  • A Thread that is sleeping can be woken with Thread.Interrupt(). This will cause sleep to throw an InterruptException. learn.microsoft.com/en-us/dotnet/api/… Commented Jul 2, 2020 at 21:33
  • You can't provide a CancellationToken if the method is not async. Commented Mar 11, 2024 at 16:16