Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/126.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ pthread mutex_init返回错误95_C++_Linux_Multithreading_Pthreads_Posix - Fatal编程技术网

C++ pthread mutex_init返回错误95

C++ pthread mutex_init返回错误95,c++,linux,multithreading,pthreads,posix,C++,Linux,Multithreading,Pthreads,Posix,我试图用属性my\u attr初始化pthread\u mutex\u init int settype_retValue=pthread_mutexattr_settype( &my_attr, PTHREAD_MUTEX_RECURSIVE); cout << " settype_retValue =0" << settype_retValue << endl; int nRet = pthread_mutex_init(&blist_m

我试图用属性my\u attr初始化pthread\u mutex\u init

int settype_retValue=pthread_mutexattr_settype( &my_attr, PTHREAD_MUTEX_RECURSIVE);

cout << " settype_retValue =0" << settype_retValue << endl;
int nRet = pthread_mutex_init(&blist_mutex, &my_attr);
if( nRet )
    cout << " mutex_init returned " << nRet << endl;
else
    cout << " mutex_init has initilised without any error\n;
int settype\u retValue=pthread\u mutexattr\u settype(&my\u attr,pthread\u MUTEX\u RECURSIVE);

请问blist_互斥体和settype_retValue是如何定义的?在Linux上,95是“EOPNOTSUPP”(不支持)。您是否正确初始化了my_attr(我的属性)
?请检查blist_互斥体和settype_retValue的定义。您可以让它通过
strerror(nRet)
为错误代码提供一个字符串,对于95,我认为它是“不支持的操作”。我认为您必须首先为
my\u attr
使用
pthread\u mutexttr\u init()
。您只需在使用它之前初始化您正在使用的属性,而且pthread\u mutex\u init()显然已经使用了您的属性。