CancellationToken.WaitHandle Property

Definition

Gets a WaitHandle that is signaled when the token is canceled.

public:
 property System::Threading::WaitHandle ^ WaitHandle { System::Threading::WaitHandle ^ get(); };
public System.Threading.WaitHandle WaitHandle { get; }
member this.WaitHandle : System.Threading.WaitHandle
Public ReadOnly Property WaitHandle As WaitHandle

Property Value

A WaitHandle that is signaled when the token is canceled.

Exceptions

The associated CancellationTokenSource has been disposed.

Remarks

Accessing this property causes a WaitHandle to be instantiated. It is preferable to only use this property when necessary, and to then dispose the associated CancellationTokenSource instance at the earliest opportunity (disposing the source will dispose of this allocated handle). The handle should not be closed or disposed directly.

Applies to

See also