mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
30 lines
459 B
C
30 lines
459 B
C
/*
|
|
* @@name: tasking.7c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
|
|
int tp;
|
|
#pragma omp threadprivate(tp)
|
|
int var;
|
|
void work()
|
|
{
|
|
#pragma omp task
|
|
{
|
|
/* do work here */
|
|
#pragma omp task
|
|
{
|
|
tp = 1;
|
|
/* do work here */
|
|
#pragma omp task
|
|
{
|
|
/* no modification of tp */
|
|
}
|
|
var = tp; //value of tp can be 1 or 2
|
|
}
|
|
tp = 2;
|
|
}
|
|
}
|