I use std::mutex and std::lock_guard in the correct RAII form throughout the application:
struct Foo { int f() const { std::lock_guard<std::mutex> locker(m_mutex); return m_i; } private: int m_i = 0; mutable std::mutex m_mutex; };
It always worked, but I added another class to parallelism, and in this new class locker throws std::system_error . The problem here ( xthread header):
inline int _Mtx_lockX(_Mtx_t *_Mtx) { // throw exception on failure return (_Check_C_return(_Mtx_lock(_Mtx))); }
_Mtx_lock returns 3, and the expected value is 0. I do not know what 3 means.
VS2013, v120_x64.
c ++ multithreading windows mutex c ++ 11
Violet giraffe
source share