mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
23 lines
395 B
C
23 lines
395 B
C
/*
|
|
* @@name: task_dep.3c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: yes
|
|
* @@expect: success
|
|
*/
|
|
#include <stdio.h>
|
|
int main() {
|
|
int x;
|
|
#pragma omp parallel
|
|
#pragma omp single
|
|
{
|
|
#pragma omp task shared(x) depend(out: x)
|
|
x = 1;
|
|
#pragma omp task shared(x) depend(out: x)
|
|
x = 2;
|
|
#pragma omp taskwait
|
|
printf("x = %d\n", x);
|
|
}
|
|
return 0;
|
|
}
|