task

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

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

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

 

ThrowIfCancellationRequested Throws a OperationCanceledException if this token has had cancellation requested.

posted on 2014-06-30 16:30  shoutcharter  阅读(130)  评论(0)    收藏  举报

导航