Cancelling Parallel Loops

added by BlackWasp
12/28/2011 10:02:22 AM

2 Kicks, 121 Views

The Task Parallel Library includes static methods that provide parallel equivalents of the for and foreach loops. As with parallel tasks, these loops can be cancelled by other processes using a system of cancellation tokens.


12/28/2011 10:04:51 AM
It's interesting that you can use the same cancellation tokens for tasks and loops. Personally I'd be a little worried about the spaghetti code that might encourage some people to write. I feel like separation of concerns would segregate all the functionality that needed to be cancelled by a particular token into one task.

12/30/2011 3:18:06 PM