Hash :
f7576a33
Author :
Date :
2024-08-07T19:53:37
pthread-rwlock: Fix default wait queue behaviour on glibc/Linux. * lib/pthread.in.h: If REPLACE_PTHREAD_RWLOCK_INIT is 1 but REPLACE_PTHREAD_RWLOCK_DESTROY is 0, override PTHREAD_RWLOCK_INITIALIZER. * lib/pthread-rwlock.c (pthread_rwlockattr_init) [PTHREAD_RWLOCK_BAD_WAITQUEUE]: New function. (pthread_rwlock_init) [PTHREAD_RWLOCK_BAD_WAITQUEUE]: New function. * m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Check for reasonable pthread_rwlock wait queue handling. Set REPLACE_PTHREAD_RWLOCK_INIT and REPLACE_PTHREAD_RWLOCKATTR_INIT and define PTHREAD_RWLOCK_BAD_WAITQUEUE if not. * modules/pthread-rwlock (configure.ac): Update GL_COND_OBJ_PTHREAD_RWLOCK condition. * doc/posix-functions/pthread_rwlock_rdlock.texi: Mark the glibc problem as fixed. * doc/posix-functions/pthread_rwlock_tryrdlock.texi: Likewise. * doc/posix-functions/pthread_rwlock_timedrdlock.texi: Likewise.
@node pthread_rwlock_timedrdlock
@subsection @code{pthread_rwlock_timedrdlock}
@findex pthread_rwlock_timedrdlock
POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_rwlock_timedrdlock.html}
Gnulib module: pthread-rwlock
Portability problems fixed by Gnulib:
@itemize
@item
This function is missing on some platforms:
macOS 14, FreeBSD 5.2.1, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 9, Cygwin 1.7.x, mingw, MSVC 14, Android 4.3.
But the provided replacement is just a dummy on some of these platforms:
Minix 3.1.8.
@item
This function prefers readers to writers (meaning, when this function is
called on an rwlock that is already taken by one or more readers, and
another writer is already waiting to take it, this function may return
successfully immediately) -- a behaviour that may lead to writer starvation --
on some platforms:
glibc 2.40.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@end itemize