1 // RUN: %libomp-compile-and-run
4 #include "omp_testsuite.h"
5 #include "omp_my_sleep.h"
7 int test_omp_task_final()
10 int includedtids
[NUM_TASKS
];
17 for (i
= 0; i
< NUM_TASKS
; i
++) {
18 /* First we have to store the value of the loop index in a new variable
19 * which will be private for each task because otherwise it will be overwritten
20 * if the execution of the task takes longer than the time which is needed to
21 * enter the next step of the loop!
26 #pragma omp task final(i>=10)
28 tids
[myi
] = omp_get_thread_num();
29 /* we generate included tasks for final tasks */
35 includedtids
[included
] = omp_get_thread_num();
36 } /* end of omp included task of the final task */
38 } /* end of if it is a final task*/
39 } /* end of omp task */
42 } /*end of parallel */
44 /* Now we ckeck if more than one thread executed the final task and its included task. */
45 for (i
= 10; i
< NUM_TASKS
; i
++) {
46 if (tids
[i
] != includedtids
[i
]) {
51 } /* end of check_paralel_for_private */
58 for(i
= 0; i
< REPETITIONS
; i
++) {
59 if(!test_omp_task_final()) {