mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-21 13:21:22 +01:00
30 lines
491 B
C
30 lines
491 B
C
/*
|
|
* @@name: tasking.8c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
* @@version: omp_3.0
|
|
*/
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|