TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Reentrant, read/write pthread mutexes

1 pointsby codr4lifeover 8 years ago

1 comment

wahernover 8 years ago
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 未加载