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.
if (x!=0) {
#pragma omp barrier /* valid usage */
}
if (x!=0) #pragma omp barrier /* invalid usage */