CancellationToken.UnsafeRegister Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Overload
UnsafeRegister(Action<Object,CancellationToken>, Object) |
Registra un delegato che verrà chiamato quando questo cancelToken viene annullato. |
UnsafeRegister(Action<Object>, Object) |
Registra un delegato che viene chiamato quando questo oggetto CancellationToken viene annullato. |
UnsafeRegister(Action<Object,CancellationToken>, Object)
Registra un delegato che verrà chiamato quando questo cancelToken viene annullato.
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
Parametri
- callback
- Action<Object,CancellationToken>
Delegato da eseguire quando l'oggetto CancelToken viene annullato.
- state
- Object
Stato da passare all'oggetto callback
quando il delegato viene richiamato. Può assumere il valore null
.
Restituisce
Istanza di CancellationTokenRegistration che può essere usata per annullare la registrazione del callback.
Eccezioni
callback
è null
.
Commenti
Se questo token è già nello stato annullato, il delegato verrà eseguito immediatamente e sincrono. Qualsiasi eccezione generata dal delegato viene propagata fuori da questa chiamata al metodo. ExecutionContext non viene acquisito o eseguito il flusso alla chiamata del callback.
Si applica a
UnsafeRegister(Action<Object>, Object)
Registra un delegato che viene chiamato quando questo oggetto CancellationToken viene annullato.
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
Parametri
Delegato da eseguire quando l'oggetto CancellationToken viene annullato.
- state
- Object
Stato da passare all'oggetto callback
quando il delegato viene richiamato. Può assumere il valore null
.
Restituisce
Oggetto che può essere usato per annullare la registrazione del callback.
Eccezioni
callback
è null.
Commenti
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.
Non ExecutionContext viene acquisito o eseguito il flusso alla chiamata del callback.