#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

Read syntax diagramSkip visual syntax diagram>>-#--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  */