For various reasons I have to use boost::threads in some parts of my code, and OpenMP threads in others. Boost threads and OpenMP may call the same underlying routine which may require a critical lock What I am finding is that a construct
#pragma omp critical
has no locking effect when called from , say, a boost::thread, only when inside a OMP parallel region.
I suppose that makes sense, but is a bit of a pain, as I will have to re-imlement all these critical regions using boost mutex ( which of course will work with any threading model).