1#include <omp.h> 2#include <stdlib.h> 3 4int 5main (void) 6{ 7 int l = 0; 8 omp_nest_lock_t lock; 9 omp_init_nest_lock (&lock); 10 if (omp_test_nest_lock (&lock) != 1) 11 abort (); 12 if (omp_test_nest_lock (&lock) != 2) 13 abort (); 14#pragma omp parallel if (0) reduction (+:l) 15 { 16 /* In OpenMP 2.5 this was supposed to return 3, 17 but in OpenMP 3.0 the parallel region has a different 18 task and omp_*_lock_t are owned by tasks, not by threads. */ 19 if (omp_test_nest_lock (&lock) != 0) 20 l++; 21 } 22 if (l) 23 abort (); 24 if (omp_test_nest_lock (&lock) != 3) 25 abort (); 26 omp_unset_nest_lock (&lock); 27 omp_unset_nest_lock (&lock); 28 omp_unset_nest_lock (&lock); 29 omp_destroy_nest_lock (&lock); 30 return 0; 31} 32