CancellationTokenRegistration CancellationTokenRegistration CancellationTokenRegistration CancellationTokenRegistration Struct

Definición

Representa un delegado de devolución de llamada que se ha registrado con un token CancellationToken.Represents a callback delegate that has been registered with a CancellationToken.

public value class CancellationTokenRegistration : IDisposable, IEquatable<System::Threading::CancellationTokenRegistration>
public struct CancellationTokenRegistration : IDisposable, IEquatable<System.Threading.CancellationTokenRegistration>
type CancellationTokenRegistration = struct
    interface IDisposable
Public Structure CancellationTokenRegistration
Implements IDisposable, IEquatable(Of CancellationTokenRegistration)
Herencia
CancellationTokenRegistrationCancellationTokenRegistrationCancellationTokenRegistrationCancellationTokenRegistration
Implementaciones

Comentarios

Se llama a la devolución de llamada cuando se cancela el token.The callback is called when the token is canceled. Para anular el registro de una devolución de llamada, elimine la instancia de registro correspondiente.To unregister a callback, dispose the corresponding Registration instance. Para obtener más información y ejemplos de código, vea cancelación ensubprocesos administrados.For more information and code examples see Cancellation in Managed Threads.

Propiedades

Token Token Token Token

Obtiene el elemento CancellationToken al que está asociado este registro.Gets the CancellationToken with which this registration is associated. Si el registro no está asociado a un token (como después de eliminar el registro), esto devolverá un token de forma predeterminada.If the registration isn't associated with a token (such as after the registration has been disposed), this will return a default token.

Métodos

Dispose() Dispose() Dispose() Dispose()

Libera todos los recursos usados por la instancia actual de la clase CancellationTokenRegistration.Releases all resources used by the current instance of the CancellationTokenRegistration class.

DisposeAsync() DisposeAsync() DisposeAsync() DisposeAsync()

Elimina el registro y anula el registro de la devolución de llamada de destino del elemento CancellationToken asociado.Disposes of the registration and unregisters the target callback from the associated CancellationToken.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si la instancia de CancellationTokenRegistration actual es igual que la instancia de CancellationTokenRegistration especificada.Determines whether the current CancellationTokenRegistration instance is equal to the specified CancellationTokenRegistration.

Equals(CancellationTokenRegistration) Equals(CancellationTokenRegistration) Equals(CancellationTokenRegistration) Equals(CancellationTokenRegistration)

Determina si la instancia de CancellationTokenRegistration actual es igual que la instancia de CancellationTokenRegistration especificada.Determines whether the current CancellationTokenRegistration instance is equal to the specified CancellationTokenRegistration.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Sirve como función hash de un objeto CancellationTokenRegistration.Serves as a hash function for a CancellationTokenRegistration.

Unregister() Unregister() Unregister() Unregister()

Elimina el registro y anula el registro de la devolución de llamada de destino del elemento CancellationToken asociado.Disposes of the registration and unregisters the target callback from the associated CancellationToken.

Operadores

Equality(CancellationTokenRegistration, CancellationTokenRegistration) Equality(CancellationTokenRegistration, CancellationTokenRegistration) Equality(CancellationTokenRegistration, CancellationTokenRegistration) Equality(CancellationTokenRegistration, CancellationTokenRegistration)

Determina si dos instancias de CancellationTokenRegistration son iguales.Determines whether two CancellationTokenRegistration instances are equal.

Inequality(CancellationTokenRegistration, CancellationTokenRegistration) Inequality(CancellationTokenRegistration, CancellationTokenRegistration) Inequality(CancellationTokenRegistration, CancellationTokenRegistration) Inequality(CancellationTokenRegistration, CancellationTokenRegistration)

Determina si dos instancias de CancellationTokenRegistration no son iguales.Determines whether two CancellationTokenRegistration instances are not equal.

Se aplica a

Seguridad para subprocesos

Todos los miembros públicos y protegidos CancellationTokenRegistration de son seguros para subprocesos y se pueden usar simultáneamente desde varios subprocesos, con la excepción de Dispose, que solo se debe usar cuando se CancellationTokenRegistration hayan completado todas las demás operaciones en.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.

Consulte también: