PTHREAD_RECURSIVE_MUTEX_INITIALIZER 和 PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP 有什么区别? [英] What is the difference between PTHREAD_RECURSIVE_MUTEX_INITIALIZER and PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP?

查看:197
本文介绍了PTHREAD_RECURSIVE_MUTEX_INITIALIZER 和 PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

静态初始化递归互斥锁时,有什么区别

When statically initializing a recursive mutex, what is the difference between

static pthread_mutex_t foo_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;

static pthread_mutex_t foo_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;

为什么我要一个而不是另一个?

and why should I want the one instead of the other?

推荐答案

"_NP" 暗示该功能是不可移植的.为了保持提示,最好使用_NP"版本.

"_NP" is meant as a hint that the feature is nonportable. In order to keep the hint there, you are best off to use the "_NP" version.

除此之外,我怀疑没有区别.不过也不是 100% 确定.

Other than that I suspect there is no difference. Not 100% sure, though.

这篇关于PTHREAD_RECURSIVE_MUTEX_INITIALIZER 和 PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆