source:
CIVL/mods/dev.civl.com/examples/omp/sharedVar1.cvl@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 232 bytes | |
| Line | |
|---|---|
| 1 | #include <omp.h> |
| 2 | #include <stdio.h> |
| 3 | |
| 4 | static omp_lock_t lock; |
| 5 | |
| 6 | void f() { |
| 7 | omp_set_lock(&lock); |
| 8 | omp_unset_lock(&lock); |
| 9 | } |
| 10 | |
| 11 | int main(){ |
| 12 | omp_init_lock(&lock); |
| 13 | |
| 14 | #pragma omp parallel |
| 15 | { |
| 16 | f(); |
| 17 | } |
| 18 | omp_destroy_lock(&lock); |
| 19 | } |
Note:
See TracBrowser
for help on using the repository browser.
