CancellationToken.WaitHandle 属性
定义
获取在取消标记时收到信号的 WaitHandle。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
属性值
在取消标记时收到信号的 WaitHandle。A WaitHandle that is signaled when the token is canceled.
例外
关联 CancellationTokenSource 已被释放。The associated CancellationTokenSource has been disposed.
注解
如果访问此属性,则会 WaitHandle 实例化。Accessing this property causes a WaitHandle to be instantiated. 最好只在必要时使用此属性,然后在最早的机会中释放关联的 CancellationTokenSource 实例, (释放源将释放此分配的句柄) 。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.