Thursday, June 16, 2011

.NET - Start Asynchronous Parallel Task and Cancel Them Too

I was having a good discussion with a couple of friends about the support of parallel tasks in .NET. If you too are interested in the same, I have written a couple of articles that can give you an overview of the support for parallelism and concurrency in .NET applications.

Parallel Tasks in .NET 4.0 -   The Parallel class found in the System.Threading.Tasks namespace “provides library-based data parallel replacements for common operations such as for loops, for each loops, and execution of a set of statements”. In this article, we will use the Invoke method of the Parallel class to call multiple methods, possibly in parallel.

Parallel Tasks in .NET 4.0 (Part II) – Methods that Return value - In one of the previous articles Parallel Tasks in .NET 4.0, we explored a set of new API’s called the "Task Parallel Library (TPL)" which simplifies the process of adding parallelism and concurrency to applications. We used the System.Threading.Tasks.Parallel.Invoke() to call methods that did not return a value. However for methods that return a value, you would need to use the Task(TResult) class which represents an asynchronous operation that can return a value. We will explore how to use this class in this article
Cancelling Tasks in .NET 4.0 - In one of the previous articles Parallel Tasks in .NET 4.0 (Part II) – Methods that Return value, we used the Task(TResult) class which represents an asynchronous operation that can return a value. In this article, we will see how to cancel a task/operation.

Read more: dev Curry