O'Reilly logo

C# Multithreaded and Parallel Programming by Rodney Ringler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Waiting for multiple tasks to complete

In the previous section, we examined how to explicitly and implicitly wait on a task to complete. Now, let's see how we can control execution and waiting when we start many tasks instead of just one.

Sometimes, we may want to wait on one task out of a group to finish. Sometimes, we might want to wait on all of the tasks to finish, and other times we might want to wait on a certain condition of tasks to finish before proceeding.

The following screenshot shows all of the Wait and When methods provided with the Task class. The Wait methods are as shown:

Waiting for multiple tasks to complete

The When methods are as shown:

Both images are references from ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required