OpenMP-Examples/sources/Example_private.2c.c
2015-01-13 11:38:24 -08:00

26 lines
453 B
C

/*
* @@name: private.2c
* @@type: C
* @@compilable: yes
* @@linkable: no
* @@expect: success
*/
int a;
void g(int k) {
a = k; /* Accessed in the region but outside of the construct;
* therefore unspecified whether original or private list
* item is modified. */
}
void f(int n) {
int a = 0;
#pragma omp parallel for private(a)
for (int i=1; i<n; i++) {
a = i;
g(a*2); /* Private copy of "a" */
}
}