CancellationTokenRegistration
Struct
Definition
Represents a callback delegate that has been registered with a CancellationToken.
public struct CancellationTokenRegistration : IDisposable, IEquatable<System.Threading.CancellationTokenRegistration>
- Inheritance
- Implements
Remarks
The callback is called when the token is canceled. To unregister a callback, dispose the corresponding Registration instance. For more information and code examples see Cancellation in Managed Threads.
Methods
| Dispose() |
Releases all resources used by the current instance of the CancellationTokenRegistration class. |
| Equals(Object) |
Determines whether the current CancellationTokenRegistration instance is equal to the specified CancellationTokenRegistration. |
| Equals(CancellationTokenRegistration) |
Determines whether the current CancellationTokenRegistration instance is equal to the specified CancellationTokenRegistration. |
| GetHashCode() |
Serves as a hash function for a CancellationTokenRegistration. |
Operators
| Equality(CancellationTokenRegistration, CancellationTokenRegistration) |
Determines whether two CancellationTokenRegistration instances are equal. |
| Inequality(CancellationTokenRegistration, CancellationTokenRegistration) |
Determines whether two CancellationTokenRegistration instances are not equal. |
Thread Safety
All public and protected members of CancellationTokenRegistration are thread-safe and may be used concurrently from multiple threads, with the exception of Dispose, which must only be used when all other operations on the CancellationTokenRegistration have completed.