blob: e5fc758d2834c1e8167d83b27dc46e4a3ca17d6c (
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
|
#include <stdlib.h>
#include <unistd.h>
int
main ()
{
int x = 0, y = 0;
#pragma omp parallel shared(x, y)
#pragma omp master
{
#pragma omp task depend(out:y) shared(x, y)
{
sleep (1);
x = 1;
y = 1;
}
#pragma omp task depend(inout:y) shared(x, y)
{
if (x != 1 || y != 1)
abort ();
y++;
}
}
if (x != 1 || y != 2)
abort ();
x = 0;
y = 0;
#pragma omp parallel
#pragma omp master
{
#pragma omp task depend(out:y)
{
sleep (1);
x = 1;
y = 1;
}
#pragma omp task depend(inout:y)
{
if (x != 1 || y != 1)
abort ();
y++;
}
}
if (x != 1 || y != 2)
abort ();
return 0;
}
|