blob: c897265ef8b47e7a467b9ec31db003f09a4aa031 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// { dg-do run }
// { dg-set-target-env-var OMP_CANCELLATION "true" }
#include <unistd.h>
#include <omp.h>
#include "cancel-test.h"
void
foo ()
{
S a, b, c, d, e, f;
#pragma omp parallel private (c, d) firstprivate (e, f)
#pragma omp taskgroup
{
c.bump ();
e.bump ();
#pragma omp task firstprivate (b, f) private (d)
{
S h;
b.bump ();
d.bump ();
f.bump ();
#pragma omp cancel taskgroup
if (omp_get_cancellation ())
abort ();
}
}
#pragma omp parallel private (c, d) firstprivate (e, f)
{
#pragma omp barrier
#pragma omp single
#pragma omp taskgroup
{
int i;
c.bump ();
e.bump ();
for (i = 0; i < 50; i++)
#pragma omp task firstprivate (b, f) private (d)
{
S h;
b.bump ();
d.bump ();
f.bump ();
#pragma omp cancellation point taskgroup
usleep (30);
#pragma omp cancel taskgroup if (i > 5)
}
}
usleep (10);
}
}
int
main ()
{
foo ();
S::verify ();
}
|