#pragma omp barrier

Purpose

The omp barrier directive identifies a synchronization point at which threads in a parallel region will not execute beyond the omp barrier until all other threads in the team complete all explicit tasks in the region.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-#--pragma--omp barrier--------------------------------------><

Usage

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  */


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us