mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-24 14:51:25 +01:00
29 lines
502 B
C
29 lines
502 B
C
/*
|
|
* @@name: task_dep.12
|
|
* @@type: C
|
|
* @@operation: run
|
|
* @@expect: success
|
|
* @@version: omp_4.0
|
|
*/
|
|
#include <stdio.h>
|
|
int main ()
|
|
{
|
|
int x = 0;
|
|
#pragma omp parallel
|
|
#pragma omp single
|
|
{
|
|
/* first explicit task */
|
|
#pragma omp task shared(x) depend(out: x)
|
|
x = 1;
|
|
|
|
/* second explicit task */
|
|
#pragma omp task shared(x) depend(inout: x) if(0)
|
|
x = 2;
|
|
|
|
/* statement executed by parent implicit task
|
|
prints: x = 2 */
|
|
printf("x = %d\n", x);
|
|
}
|
|
return 0;
|
|
}
|