© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
V. SarcarParallel Programming with C# and .NEThttps://doi.org/10.1007/979-8-8688-0488-5_2

2. Handling Special Scenarios

Vaskaran Sarcar1  
(1)
Near Garia Station, Post: Garia, Kuntala Furniture, 2nd Floor, Kolkata, West Bengal, India
 

In Chapter 1, you learned about various aspects of tasks including continuation tasks and nested tasks. In this chapter, I’ll continue the discussion of task programming, but this time the focus will be handling special scenarios such as exceptions and cancellations. Let’s get started.

Introduction to Exceptions

In a multithreaded environment, handling exceptions can be tricky. The reason is obvious: different tasks may throw different ...

Get Parallel Programming with C# and .NET: Fundamentals of Concurrency and Asynchrony Behind Fast-Paced Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.