PR target/82855
[official-gcc.git] / libgomp / testsuite / libgomp.c / cancel-taskgroup-2.c
blobc7b8bf756237cd470cc8b81a2842e5bbf24b2d33
1 /* { dg-do run } */
2 /* { dg-set-target-env-var OMP_CANCELLATION "true" } */
4 #include <stdlib.h>
5 #include <unistd.h>
6 #include <omp.h>
8 int
9 main ()
11 #pragma omp parallel
12 #pragma omp taskgroup
13 #pragma omp task
15 #pragma omp cancel taskgroup
16 if (omp_get_cancellation ())
17 abort ();
19 #pragma omp parallel
21 #pragma omp barrier
22 #pragma omp single
23 #pragma omp taskgroup
25 int i;
26 for (i = 0; i < 50; i++)
27 #pragma omp task
29 #pragma omp cancellation point taskgroup
30 usleep (30);
31 #pragma omp cancel taskgroup if (i > 5)
34 usleep (10);
36 return 0;