1 // RUN: %libomp-compile-and-run
3 // This test is known to be fragile on NetBSD kernel at the moment,
4 // https://bugs.llvm.org/show_bug.cgi?id=42020.
8 #include "omp_testsuite.h"
9 #include "omp_my_sleep.h"
11 int test_omp_taskwait()
13 int result1
= 0; /* Stores number of not finished tasks after the taskwait */
14 int result2
= 0; /* Stores number of wrong array elements at the end */
19 for (i
= 0; i
< NUM_TASKS
; i
++)
26 for (i
= 0; i
< NUM_TASKS
; i
++) {
27 /* First we have to store the value of the loop index in a new variable
28 * which will be private for each task because otherwise it will be overwritten
29 * if the execution of the task takes longer than the time which is needed to
30 * enter the next step of the loop!
38 } /* end of omp task */
41 /* check if all tasks were finished */
42 for (i
= 0; i
< NUM_TASKS
; i
++)
46 /* generate some more tasks which now shall overwrite
47 * the values in the tids array */
48 for (i
= 0; i
< NUM_TASKS
; i
++) {
54 } /* end of omp task */
57 } /*end of parallel */
59 /* final check, if all array elements contain the right values: */
60 for (i
= 0; i
< NUM_TASKS
; i
++) {
64 return ((result1
== 0) && (result2
== 0));
72 for(i
= 0; i
< REPETITIONS
; i
++) {
73 if(!test_omp_taskwait()) {