Skip gnat.dg/prot7.adb on hppa.
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / cancel-taskgroup-4.c
blob341bfb84ea8ef4b6037d5d35cda1ab57f08393be
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 int i;
12 #pragma omp parallel
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++)
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 ();
29 usleep (10);
31 return 0;