Intel® C++ Compiler 16.0 User and Reference Guide

omp taskwait

Specifies a wait on the completion of child tasks generated since the beginning of the current task.

Syntax

#pragma omp taskwait

Arguments

None

Description

This pragma specifies a wait on the completion of child tasks generated since the beginning of the current task. The taskwait region includes an implicit task scheduling point in the current task region. The current task region is suspended at the task scheduling point until execution of all its child tasks generated before the taskwait region are completed.

Example

#pragma omp task      // Task 1
{ ...
  #pragma omp task    // Task 2
  { do_work1(); }
  #pragma omp task    // Task 3
  {  ...
   #pragma omp task   // Task 4
     {  do_work2(); }
       ...
     }
     #pragma omp taskwait
     ...
  }
}

The taskwait pragma causes Task 3 to wait until the completion of Task 4. It does not wait for the completion of Task 2 or Task 1.

See Also