O'Reilly logo

C++ Multithreading Cookbook by Milos Ljumovic

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

The Barrier class

Among the synchronization base classes for task coordination, an excellent feature of .NET is the Barrier class. Even though locking is an excellent mechanism, you will almost certainly find yourself in a situation where some very complex task issues another mechanism that you would need to solve successfully. The Barrier class enables you to temporarily stop (pause) execution of a task or a collection of tasks at a certain point in the application and continue when all tasks reach that point. For synchronization, this feature is important in order for a series of multiple tasks to be executed in parallel steps.

When an application creates a Barrier object, it has to specify the number of tasks in set that will be synchronized. ...

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