#pragma omp barrier

Description

The omp barrier directive identifies a synchronization point at which threads in a parallel region will wait until all other threads in that section reach the same point. Statement execution past the omp barrier point then continues in parallel.

Syntax

#pragma omp barrier

Notes

The omp barrier directive must appear within a block or compound statement. For example:

if (x!=0) {
   #pragma omp barrier    /* valid usage    */
}
 
if (x!=0)
   #pragma omp barrier    /* invalid usage  */

Related References

Pragmas to Control Parallel Processing IBM Copyright 2003