Answer
CancellationToken carries a cooperative cancellation request to an operation. • The caller requests cancellation through a CancellationTokenSource. • The operation observes the token and chooses a safe point to stop. • Cancellation does not forcibly terminate a thread or roll back completed side effects.
💡 C# Example
static async Task WorkAsync(CancellationToken token)
{
await Task.Delay(TimeSpan.FromSeconds(5), token);
}
⚡ Quick Revision
CancellationToken enables cooperative cancellation rather than forced termination.