mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
26 lines
453 B
C
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" */
|
|
}
|
|
}
|