1 // RUN: %libomp-compile-and-run
3 #include "omp_testsuite.h"
7 int test_omp_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
++) {
19 omp_set_nest_lock(&lck
);
21 nr_threads_in_single
++;
24 nr_threads_in_single
--;
25 result
= result
+ nr_threads_in_single
;
26 omp_unset_nest_lock(&lck
);
29 omp_destroy_nest_lock(&lck
);
31 return ((result
== 0) && (nr_iterations
== LOOPCOUNT
));
39 for(i
= 0; i
< REPETITIONS
; i
++) {
40 if(!test_omp_nest_lock()) {