Summary

Taking advantage of multicore machines is becoming increasingly important. From a programmer’s point of view, various facilities in the System.Threading libraries make it easier to do so.

In this chapter, we explored the notion of task parallelism centered around the Task and Task<TResult> types. We discussed how to create tasks, await their results, work with continues, and deal with various aspects such as errors and cancellation. In summary, tasks are the new means to perform work asynchronously, whether it’s long running (where you’d have used threads before) or more ad hoc short-lived computations (using thread pools before). We also discussed how the task scheduler works, layered atop of the improved thread pool, employing techniques ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.