#pragma omp flush


The omp flush directive identifies a point at which the compiler ensures that all threads in a parallel region have the same view of specified objects in memory.


Read syntax diagramSkip visual syntax diagram                         .-+---+----.
                         | '-,-'    |
                         V          |
>>-#--pragma--omp flush----+------+-+--------------------------><

where list is a comma-separated list of variables that will be synchronized.


If list includes a pointer, the pointer is flushed, not the object being referred to by the pointer. If list is not specified, all shared objects are synchronized except those inaccessible with automatic storage duration.

An implied flush directive appears in conjunction with the following directives:

The omp flush directive must appear within a block or compound statement. For example:

if (x!=0) {
   #pragma omp flush    /* valid usage    */
if (x!=0)
   #pragma omp flush    /* invalid usage  */