Do all mutex implementations ultimately cause the same basic system / hardware calls - which means they can be interchangeable?
In particular, if I use __gnu_parallel algorithms (which use openmp ), and I want the classes that they called threadafe to use boost::mutex to block? or should I write my own mutex such as described here
Edit, the link above to mutex openmp seems to be broken, for anyone interested, the lock that goes with this mutez is in these lines
class Lock { public: Lock(Mutex& mutex) : m_mutex(mutex), m_release(false) { m_mutex.lock(); } ~Lock() { if (!m_release) m_mutex.unlock(); } bool operator() const { return !m_release; } void release() { if (!m_release) { m_release = true; m_mutex.unlock(); } } private: Mutex& m_mutex; bool m_release; };
source share