Mercurial > hg > CbC > CbC_gcc
comparison libgomp/testsuite/libgomp.c/lock-2.c @ 0:a06113de4d67
first commit
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2009 14:47:48 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a06113de4d67 |
---|---|
1 #include <omp.h> | |
2 #include <stdlib.h> | |
3 | |
4 int | |
5 main (void) | |
6 { | |
7 int l = 0; | |
8 omp_nest_lock_t lock; | |
9 omp_init_nest_lock (&lock); | |
10 #pragma omp parallel reduction (+:l) num_threads (1) | |
11 { | |
12 if (omp_test_nest_lock (&lock) != 1) | |
13 l++; | |
14 if (omp_test_nest_lock (&lock) != 2) | |
15 l++; | |
16 #pragma omp task if (0) shared (lock, l) | |
17 { | |
18 if (omp_test_nest_lock (&lock) != 0) | |
19 l++; | |
20 } | |
21 #pragma omp taskwait | |
22 if (omp_test_nest_lock (&lock) != 3) | |
23 l++; | |
24 omp_unset_nest_lock (&lock); | |
25 omp_unset_nest_lock (&lock); | |
26 omp_unset_nest_lock (&lock); | |
27 } | |
28 if (l) | |
29 abort (); | |
30 omp_destroy_nest_lock (&lock); | |
31 return 0; | |
32 } |