1 // RUN: %libomp-compile-and-run
3 #include "omp_testsuite.h"
5 static omp_nest_lock_t lck
;
7 int test_omp_test_nest_lock()
9 int nr_threads_in_single
= 0;
11 int nr_iterations
= 0;
14 omp_init_nest_lock (&lck
);
15 #pragma omp parallel shared(lck)
18 for (i
= 0; i
< LOOPCOUNT
; i
++)
20 /*omp_set_lock(&lck);*/
21 while(!omp_test_nest_lock (&lck
))
24 nr_threads_in_single
++;
27 nr_threads_in_single
--;
28 result
= result
+ nr_threads_in_single
;
29 omp_unset_nest_lock (&lck
);
32 omp_destroy_nest_lock (&lck
);
33 return ((result
== 0) && (nr_iterations
== LOOPCOUNT
));
41 for(i
= 0; i
< REPETITIONS
; i
++) {
42 if(!test_omp_test_nest_lock()) {