Category Archives: Parallel

Final Thoughts on CancellationTokenSource with Tasks and Parallel Operations

So, after running all of these tests and observing the different behaviors, I think I can provide a summary on what to expect when cancelling tasks and parallel operations in this way. I also think it is important to understand … Continue reading

Posted in Asynchrony, Parallel | Tagged , | 1 Comment

Understanding CancellationTokenSource with Parallel

CancellationTokenSource also works with Parallel.For, Parallel.ForEach, and Parallel LINQ much like with Task. The behavior is similar, but not the same. When starting a Parallel.For or ForEach, you can pass in a ParallelOptions object that contains the CancellationToken. When starting … Continue reading

Posted in Asynchrony, Parallel, Unit Tests | Tagged , , | 2 Comments