testsuite/libgomp.c/lock-2.c

Go to the documentation of this file.
00001 #include <omp.h>
00002 #include <stdlib.h>
00003 
00004 int
00005 main (void)
00006 {
00007   int l = 0;
00008   omp_nest_lock_t lock;
00009   omp_init_nest_lock (&lock);
00010 #pragma omp parallel reduction (+:l) num_threads (1)
00011   {
00012     if (omp_test_nest_lock (&lock) != 1)
00013       l++;
00014     if (omp_test_nest_lock (&lock) != 2)
00015       l++;
00016   #pragma omp task if (0) shared (lock, l)
00017     {
00018       if (omp_test_nest_lock (&lock) != 0)
00019     l++;
00020     }
00021   #pragma omp taskwait
00022     if (omp_test_nest_lock (&lock) != 3)
00023       l++;
00024     omp_unset_nest_lock (&lock);
00025     omp_unset_nest_lock (&lock);
00026     omp_unset_nest_lock (&lock);
00027   }
00028   if (l)
00029     abort ();
00030   omp_destroy_nest_lock (&lock);
00031   return 0;
00032 }

Generated on Fri Apr 5 05:38:10 2013 for Libgomp by  doxygen 1.4.7