1 // RUN: %libomp-compile-and-run
4 #include "omp_testsuite.h"
5 #include "omp_my_sleep.h"
7 int test_omp_taskyield()
11 int start_tid
[NUM_TASKS
];
12 int current_tid
[NUM_TASKS
];
14 for (i
=0; i
< NUM_TASKS
; i
++) {
23 for (i
= 0; i
< NUM_TASKS
; i
++) {
25 #pragma omp task untied
28 start_tid
[myi
] = omp_get_thread_num();
30 if((start_tid
[myi
] %2) ==0){
32 current_tid
[myi
] = omp_get_thread_num();
34 } /* end of omp task */
37 } /* end of parallel */
38 for (i
=0;i
<NUM_TASKS
; i
++) {
39 //printf("start_tid[%d]=%d, current_tid[%d]=%d\n",
40 //i, start_tid[i], i , current_tid[i]);
41 if (current_tid
[i
] == start_tid
[i
])
44 return (count
<NUM_TASKS
);
52 if (omp_get_max_threads() < 2)
53 omp_set_num_threads(8);
55 for(i
= 0; i
< REPETITIONS
; i
++) {
56 if(!test_omp_taskyield()) {