CancellationToken.UnsafeRegister(Action<Object>, Object) CancellationToken.UnsafeRegister(Action<Object>, Object) CancellationToken.UnsafeRegister(Action<Object>, Object) CancellationToken.UnsafeRegister(Action<Object>, Object) Method

定義

この CancellationToken が取り消されたときに呼び出されるデリゲートを登録します。Registers a delegate that is called when this CancellationToken is canceled.

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

パラメーター

callback
Action<Object>

CancellationToken が取り消されたときに実行されるデリゲート。The delegate to execute when the CancellationToken is canceled.

state
Object Object Object Object

デリゲートの呼び出し時に callback に渡される状態。The state to pass to the callback when the delegate is invoked. null でもかまいません。This may be null.

戻り値

コールバックの登録解除に使用できるオブジェクト。An object that can be used to unregister the callback.

例外

注釈

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.

ExecutionContextがキャプチャされていないか、コールバックの呼び出しにフローされていません。The ExecutionContext is not captured nor flowed to the callback's invocation.

適用対象