hyc@symas.com wrote:
ondra@mistotebe.net wrote:
IMO using recursive mutexes means your code is broken. We introduced these for accesslog.c but in fact we could avoid them at zero cost. Also I don't see the relevance of libevent to this discussion. We use our own event mechanism and it is more efficient than libevent.
libevent is a dependency for the load balancer that I intend to propose for integration into the project after all the relevant dependencies have come in.
There is a new version of this patch that provides an implementation on each platform or defers to the existing one (as per each platform's documentation). Untested except on POSIX and most of them seem pretty arcane anyway.
ftp://ftp.openldap.org/incoming/Ondrej-Kuznik-20170918-ITS8638-libldap_r-recursive-mutex.patch
It looks like glibc still doesn't define PTHREAD_MUTEX_RECURSIVE by default, it requires compiling with either -D_GNU_SOURCE or -D_XOPEN_SOURCE. The feature itself appears to be part of UNIX98. It's likely that all pthread implementations available today support it, but it still seems a bit iffy.
OK, I see that current glibc defaults to _POSIX_C_SOURCE=200809 which includes __XOPEN_2K8. All of this came later than our rmutex.c which was written in 2006, so that explains where the need arose from. We should be safe pushing this in, go ahead.