[英]std::mutex::lock fails on Windows, error code 3
I use std::mutex
and std::lock_guard
in a proper RAII manner throughout my application: 我在整个应用程序中以正确的RAII方式使用std::mutex
和std::lock_guard
:
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've added parallelism to one more class just now, and in this new class locker
throws std::system_error
. 它总是有效,但我刚刚在另一个类中添加了并行性,并且在这个新的类locker
抛出了std::system_error
。 The problem is here ( xthread
header): 问题出在这里( xthread
头):
inline int _Mtx_lockX(_Mtx_t *_Mtx)
{ // throw exception on failure
return (_Check_C_return(_Mtx_lock(_Mtx)));
}
_Mtx_lock
returns 3 while the expected value is 0. No idea what 3 means. _Mtx_lock
返回3而预期值为0.不知道3意味着什么。
VS2013, v120_x64 runtime. VS2013,v120_x64运行时。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.