首页 > 代码库 > task

task

task 可以通过CancellationTokenSource.token 来控制线程是否终止。

同时 还可以注册一个委托,来回调。

Register(Action)Registers a delegate that will be called when this CancellationToken is canceled.

 

ThrowIfCancellationRequestedThrows a OperationCanceledException if this token has had cancellation requested.