我想看看pthread_mutex_trylock.
通过打字man pthread_mutex_trylock,我得到了No manual entry for pthread_mutex_trylock。
然后我看到一个帖子建议做sudo apt-get install manpages-posix manpages-posix-dev。
之后,我看到如下描述:
PTHREAD_MUTEX_LOCK(3POSIX) POSIX Programmer's Manual PTHREAD_MUTEX_LOCK(3POSIX)
PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the cor?
responding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
Run Code Online (Sandbox Code Playgroud)
这个POSIX Programmer's Manual和我平时看到的Linux Programmer's Manual有什么区别?
这句话是什么意思:
此接口的 Linux 实现可能不同(有关 Linux 行为的详细信息,请参阅相应的 Linux 手册页),或者该接口可能未在 Linux 上实现。
所以,我在哪里可以找到手册页的Linux实现的 pthread_mutex_trylock?我可以pthread_mutex_trylock在我的系统上使用吗?我正在使用 Ubuntu。
之所以这么说,是因为不能保证 POSIX 手册(对于任何内容)与您的特定系统上相应内容的实际实现相对应。
要获取 的手册pthread_mutex_trylock(),请安装实现该接口的库的手册。
在 Ubuntu 系统上,所需的手册似乎是glibc-doc软件包的一部分(通过在Ubuntu 软件包搜索页面上搜索函数名称找到)。
POSIX 手册绝对不是没用的。本地 Linux 接口应该与 POSIX 手册中描述的接口兼容,但特定于实现的手册也可能会提到警告和特定于 Linux 的实现细节和扩展,以及类似的非 POSIX 功能。
如果您关心代码到其他 Unix 系统的可移植性,POSIX 手册就变得尤为重要,在这种情况下,您希望避免依赖 POSIX 规范的特定于 Linux 的扩展。