Cancellation Tokens

A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects. An object creates a cancellation token by using a CancellationTokenSource, and then passes the cancellation token to any number of threads or objects that should receive notice of cancellation. The token cannot be used to initiate cancellation. When the owning object calls Cancel on the CancellationTokenSource, the IsCancellationRequested property on every copy of the cancellation token is set to true. The objects that receive the notification can respond in whatever manner is appropriate.

For more information, see Cancellation in Managed Threads.

See Also

Concepts

Task Cancellation

Other Resources

Threading Objects and Features