I think the better word here is recursive mutex, not reentrant mutex. Because contrary to the implied claim on that page,
"The basic pthread mutex leaves a lot to wish for. Support
for reentrancy would allow varying lock granularity on the
call site."
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/glibc and linux/musl are the closest, I think. But recursive mutexes, and specifically PTHREAD_MUTEX_RECURSIVE, are supported everywhere I've checked, including all the BSDs, AIX, and Solaris.
Maybe, recursive implies calling self to me. Nice, forgot about that one. Though this little nugget is faster than even the basic mutex once you start utilizing up/downgrades. I will however look into replacing manual tracking of write depth with PTHREAD_MUTEX_RECURSIVE and compare performance.
Thank you.