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 */
Program Parallelization
Shared and Private Variables in a Parallel Environment
Countable Loops
Control Parallel Processing with Pragmas
#pragma Preprocessor Directives for Parallel Processing
OpenMP Run-time Options for Parallel Processing