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.
#pragma omp barrier
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 */