blob: c7b8bf756237cd470cc8b81a2842e5bbf24b2d33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
/* { dg-do run } */
/* { dg-set-target-env-var OMP_CANCELLATION "true" } */
#include <stdlib.h>
#include <unistd.h>
#include <omp.h>
int
main ()
{
#pragma omp parallel
#pragma omp taskgroup
#pragma omp task
{
#pragma omp cancel taskgroup
if (omp_get_cancellation ())
abort ();
}
#pragma omp parallel
{
#pragma omp barrier
#pragma omp single
#pragma omp taskgroup
{
int i;
for (i = 0; i < 50; i++)
#pragma omp task
{
#pragma omp cancellation point taskgroup
usleep (30);
#pragma omp cancel taskgroup if (i > 5)
}
}
usleep (10);
}
return 0;
}
|