blob: 14932b02b9cb239fadcfb1cdb71d9192b9fe41ab (
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
|
/* { dg-do run } */
#include <omp.h>
#include <assert.h>
/* Test chaining of detached tasks, with each task fulfilling the
completion event of the previous one. */
int main (void)
{
omp_event_handle_t detach_event1, detach_event2;
int x = 0, y = 0, z = 0;
#pragma omp parallel
#pragma omp single
{
#pragma omp task detach (detach_event1)
x++;
#pragma omp task detach (detach_event2)
{
y++;
omp_fulfill_event (detach_event1);
}
#pragma omp task
{
z++;
omp_fulfill_event (detach_event2);
}
}
assert (x == 1);
assert (y == 1);
assert (z == 1);
}
|