CancellationToken.UnsafeRegister Méthode

Définition

Surcharges

UnsafeRegister(Action<Object,CancellationToken>, Object)

Inscrit un délégué qui sera appelé lorsque ce cancellationToken est annulé.

UnsafeRegister(Action<Object>, Object)

Inscrit un délégué qui est appelé quand ce CancellationToken est annulé.

UnsafeRegister(Action<Object,CancellationToken>, Object)

Inscrit un délégué qui sera appelé lorsque ce cancellationToken est annulé.

public:
 System::Threading::CancellationTokenRegistration UnsafeRegister(Action<System::Object ^, System::Threading::CancellationToken> ^ callback, System::Object ^ state);
public System.Threading.CancellationTokenRegistration UnsafeRegister (Action<object?,System.Threading.CancellationToken> callback, object? state);
member this.UnsafeRegister : Action<obj, System.Threading.CancellationToken> * obj -> System.Threading.CancellationTokenRegistration
Public Function UnsafeRegister (callback As Action(Of Object, CancellationToken), state As Object) As CancellationTokenRegistration

Paramètres

callback
Action<Object,CancellationToken>

Délégué à exécuter lorsque cancellationToken est annulé.

state
Object

État à passer à callback lorsque le délégué est appelé. Celui-ci peut être null.

Retours

CancellationTokenRegistration

Instance de CancellationTokenRegistration qui peut être utilisée pour désinscrire le rappel.

Exceptions

callback a la valeur null.

Remarques

Si ce jeton est déjà dans l’état annulé, le délégué est exécuté immédiatement et de manière synchrone. Toute exception générée par le délégué est propagée à partir de cet appel de méthode. ExecutionContext n’est pas capturé ou acheminé vers l’appel du rappel.

S’applique à

UnsafeRegister(Action<Object>, Object)

Inscrit un délégué qui est appelé quand ce CancellationToken est annulé.

public:
 System::Threading::CancellationTokenRegistration UnsafeRegister(Action<System::Object ^> ^ callback, System::Object ^ state);
public System.Threading.CancellationTokenRegistration UnsafeRegister (Action<object?> callback, object? state);
member this.UnsafeRegister : Action<obj> * obj -> System.Threading.CancellationTokenRegistration
Public Function UnsafeRegister (callback As Action(Of Object), state As Object) As CancellationTokenRegistration

Paramètres

callback
Action<Object>

Délégué à exécuter quand CancellationToken est annulé.

state
Object

État à passer à callback lorsque le délégué est appelé. Celui-ci peut être null.

Retours

CancellationTokenRegistration

Objet qui peut être utilisé pour désinscrire le rappel.

Exceptions

callback a la valeur null.

Remarques

If this token is already in the canceled state, the delegate is run immediately and synchronously. Any exception the delegate generates is propagated out of this method call.

L’appel ExecutionContext du rappel n’est pas capturé ou acheminé vers l’appel du rappel.

S’applique à