Multithreaded Programming Guide

Exit Print View

Updated: July 2014
 
 

Using Barrier Synchronization

In cases where you must wait for a number of tasks to be completed before an overall task can proceed, barrier synchronization can be used. POSIX threads specifies a synchronization object called a barrier, along with barrier functions. The functions create the barrier, specifying the number of threads that are synchronizing on the barrier, and set up threads to perform tasks and wait at the barrier until all the threads reach the barrier. When the last thread arrives at the barrier, all the threads resume execution.

See Parallelizing a Loop on a Shared-Memory Parallel Computer for more about barrier synchronization.