How it works...

You will notice that three threads (thread 3, thread 4, and thread 5) are created. These are then paused by making them sleep for various amounts of time. After each thread wakes, the code waits for all three threads to complete before continuing the execution of the application code.

Get C# 7 and .NET Core Cookbook 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.