6 /* Test tasks with detach clause. Each thread spawns off a chain of tasks,
7 that can then be executed by any available thread. */
11 int x
= 0, y
= 0, z
= 0;
13 omp_event_handle_t detach_event1
, detach_event2
;
15 #pragma omp parallel private (detach_event1, detach_event2)
18 thread_count
= omp_get_num_threads ();
20 #pragma omp task detach (detach_event1) untied
21 #pragma omp atomic update
24 #pragma omp task detach (detach_event2) untied
26 #pragma omp atomic update
28 omp_fulfill_event (detach_event1
);
31 #pragma omp task untied
33 #pragma omp atomic update
35 omp_fulfill_event (detach_event2
);
39 assert (x
== thread_count
);
40 assert (y
== thread_count
);
41 assert (z
== thread_count
);