1 /* { dg-do run } */
2
3 #include <omp.h>
4 #include <assert.h>
5
6 /* Test chaining of detached tasks, with each task fulfilling the
7 completion event of the previous one. */
8
9 int main (void)
10 {
11 omp_event_handle_t detach_event1, detach_event2;
12 int x = 0, y = 0, z = 0;
13
14 #pragma omp parallel
15 #pragma omp single
16 {
17 #pragma omp task detach (detach_event1)
18 x++;
19
20 #pragma omp task detach (detach_event2)
21 {
22 y++;
23 omp_fulfill_event (detach_event1);
24 }
25
26 #pragma omp task
27 {
28 z++;
29 omp_fulfill_event (detach_event2);
30 }
31 }
32
33 assert (x == 1);
34 assert (y == 1);
35 assert (z == 1);
36 }