TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Reentrant, read/write pthread mutexes

1 点作者 codr4life超过 8 年前

1 comment

wahern超过 8 年前
I think the better word here is recursive mutex, not reentrant mutex. Because contrary to the implied claim on that page,<p><pre><code> &quot;The basic pthread mutex leaves a lot to wish for. Support for reentrancy would allow varying lock granularity on the call site.&quot; </code></pre> pthreads provides recursive mutexes via the PTHREAD_MUTEX_RECURSIVE mutex type specifier. It was in the 2004 POSIX specification as an XSI extension, but moved to Base in the 2008 specification. No environment is certified to POSIX 2008, AFAIK. Linux&#x2F;glibc and linux&#x2F;musl are the closest, I think. But recursive mutexes, and specifically PTHREAD_MUTEX_RECURSIVE, are supported everywhere I&#x27;ve checked, including all the BSDs, AIX, and Solaris.
评论 #13235109 未加载