Previous: Implementing SECTIONS construct, Up: The libgomp ABI


4.14 Implementing SINGLE construct

A block like

       #pragma omp single
       {
         body;
       }

becomes

       if (GOMP_single_start ())
         body;
       GOMP_barrier ();

while

       #pragma omp single copyprivate(x)
         body;

becomes

       datap = GOMP_single_copy_start ();
       if (datap == NULL)
         {
           body;
           data.x = x;
           GOMP_single_copy_end (&data);
         }
       else
         x = datap->x;
       GOMP_barrier ();