你的位置: 码友网首页 / 资讯源列表 / Cancellation, Part 4: Polling

关于[Cancellation, Part 4: Polling]的摘要:

So far in this series, I’ve talked about how to request and detect cancellation, but for the next couple of posts I’ll be switching perspectives and discussing ways to respond to cancellation. I know I’ve probably said this a half dozen times already, but it bears repeating: cancellation is cooperative. Your code will be provided a CancellationToken, and it must do something with that CancellationToken in order to be cancelable. Most of the time, this is just passing the CancellationToken down to lower-level APIs, but if you want cancelable code at the lowest level, there are a couple of other options. The one we’re looking at today is polling.

原文地址: https://blog.stephencleary.com/2022/03/cancellation-4-polling.html

收录时间: 2022-03-21 浏览量: 764 分类: .NET

| 0 收藏 | 0