[Omp] Re: critical directive or openmp_*_lock library routines?

Daniel Franke franke.daniel at gmail.com
Fri Jun 30 04:43:06 PDT 2006


Sanjiv,

> There should be no performance difference between using CRITICAL and
> omp_lock.  However, CRITICAL is global across the program whereas with
> omp_locks, you can control who else has access to that lock.

"critical across the program" means, that critical blocks will never
ever be executed in parallel even when completely unrelated? THIS is
meant by "A thread waits at the beginning of a critical section until
no other thread is executing a critical section with the same name.
All unnamed CRITICAL directives map to the same name" (from the
standard, v2.0, section 2.5.2)?!

Therefore, if I want to use a critical section to guard a variable, I
have to name it _uniquely_ or should otherwise use a private mutex
within the module. I think, I will go for the latter.

Thanks for clarification!
      Daniel


More information about the Omp mailing list