(root)/
gcc-13.2.0/
libgomp/
testsuite/
libgomp.c-c++-common/
cancel-taskgroup-4.c
       1  /* { dg-do run } */
       2  /* { dg-set-target-env-var OMP_CANCELLATION "true" } */
       3  
       4  #include <stdlib.h>
       5  #include <unistd.h>
       6  #include <omp.h>
       7  
       8  int
       9  main ()
      10  {
      11    int i;
      12    #pragma omp parallel
      13    {
      14      int c = 0;
      15      #pragma omp barrier
      16      #pragma omp master taskloop num_tasks (25) firstprivate (c)
      17      for (i = 0; i < 50; i++)
      18        {
      19          if (c && omp_get_cancellation ())
      20  	  abort ();
      21  	#pragma omp cancellation point taskgroup
      22  	usleep (30);
      23  	if (i > 10)
      24  	  c = 1;
      25  	#pragma omp cancel taskgroup if (i > 10)
      26  	if (i > 10 && omp_get_cancellation ())
      27  	  abort ();
      28        }
      29      usleep (10);
      30    }
      31    return 0;
      32  }