I'm sorry you care more multi-threaded column for so long, this article we continue to talk about the knowledge of the thread pool, which will involve the following knowledge:
- Cancel the asynchronous operation
- Event handler and wait for a timeout
- Timer
- BackgroundWorker
Zero, cancel asynchronous operation
This section will introduce two classes CancellationTokenSource and CancellationToken. These two classes are being introduced in .NET 4.0, so if we need to use these two categories must be used in .NET 4.0 and above, the current standard asynchronous operation is canceled. Here we cook through cooking, cancel the order halfway example of a look at these two classes specifically how to use.
using System.Threading;
using static System.Console;
using static System.Threading.Thread;
namespace NoSix