I have a parallel region, I have a static variable defined inside this region, like this
#pragma omp parallel
{
static int var;
// some stuff
}
Without threadprivate
, static variables are shared between threads, so there is actually one instance seen by all the threads. This source says static initialization happens first and usually at compile time. What happens in this case? Does the compiler just ignore this parallel region for the static variable and treat it as if it had been placed outside the parallel region?