1 // RUN: %libomp-compile-and-run 2 #include <stdio.h> 3 #include <math.h> 4 #include "omp_testsuite.h" 5 #include "omp_my_sleep.h" 6 test_omp_task_if()7int test_omp_task_if() 8 { 9 int condition_false; 10 int count; 11 int result; 12 13 count=0; 14 condition_false = (count == 1); 15 #pragma omp parallel 16 { 17 #pragma omp single 18 { 19 #pragma omp task if (condition_false) shared(count, result) 20 { 21 my_sleep (SLEEPTIME); 22 #pragma omp critical 23 result = (0 == count); 24 } /* end of omp task */ 25 #pragma omp critical 26 count = 1; 27 } /* end of single */ 28 } /*end of parallel */ 29 return result; 30 } 31 main()32int main() 33 { 34 int i; 35 int num_failed=0; 36 37 for(i = 0; i < REPETITIONS; i++) { 38 if(!test_omp_task_if()) { 39 num_failed++; 40 } 41 } 42 return num_failed; 43 } 44