LabWindows/CVI

Content Type
Programming Language
Current manual

parallel sections Directive

parallel sections Directive

Specifies a parallel region containing one sections directive. The parallel sections directive is a shortcut for the parallel directive followed immediately by a sections directive. The shortcut creates a team of threads and divides the sections between the threads at the same time.

Binding thread set: encountering thread

Format

#pragma omp parallel sections [clause[ [,]clause] ..] newline
   {
      #pragma omp section
      {
         code block
      }
   }

Example

int main()
{
   #pragma omp parallel sections
      {
         #pragma omp section
         printf("This is from thread %d\n", omp_get_thread_num());
         #pragma omp section
         printf("This is from thread %d\n", omp_get_thread_num());
      }
}

In This Section
Was this information helpful?