mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
29 lines
470 B
C
29 lines
470 B
C
/*
|
|
* @@name: tasking.8c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
|
|
int tp;
|
|
#pragma omp threadprivate(tp)
|
|
int var;
|
|
void work()
|
|
{
|
|
#pragma omp parallel
|
|
{
|
|
/* do work here */
|
|
#pragma omp task
|
|
{
|
|
tp++;
|
|
/* do work here */
|
|
#pragma omp task
|
|
{
|
|
/* do work here but don't modify tp */
|
|
}
|
|
var = tp; //Value does not change after write above
|
|
}
|
|
}
|
|
}
|