summaryrefslogtreecommitdiff
path: root/gl/m4/pthread_rwlock_rdlock.m4
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2020-02-25 17:11:21 +0000
committerColin Watson <cjwatson@debian.org>2020-02-25 17:11:21 +0000
commitea9974fa9eea80f19126edbd7e132186d153d2b2 (patch)
tree5f722c1f0c58d3ee73321f7e1e6ef9f5b13ec6a3 /gl/m4/pthread_rwlock_rdlock.m4
parentf2bcbd87a94c08fae249f6cc9c9fbc07aa49ef5f (diff)
parent639597d354c5b57145d6d53b079aeb4e2060d42b (diff)
Import man-db_2.9.1.orig.tar.xz
Diffstat (limited to 'gl/m4/pthread_rwlock_rdlock.m4')
-rw-r--r--gl/m4/pthread_rwlock_rdlock.m430
1 files changed, 25 insertions, 5 deletions
diff --git a/gl/m4/pthread_rwlock_rdlock.m4 b/gl/m4/pthread_rwlock_rdlock.m4
index 3c1d6456..049af50f 100644
--- a/gl/m4/pthread_rwlock_rdlock.m4
+++ b/gl/m4/pthread_rwlock_rdlock.m4
@@ -1,5 +1,5 @@
-# pthread_rwlock_rdlock.m4 serial 2
-dnl Copyright (C) 2017-2019 Free Software Foundation, Inc.
+# pthread_rwlock_rdlock.m4 serial 4
+dnl Copyright (C) 2017-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -26,14 +26,16 @@ dnl
dnl POSIX:2017 makes this requirement only for implementations that support TPS
dnl (Thread Priority Scheduling) and only for the scheduling policies SCHED_FIFO
dnl and SCHED_RR, see
-dnl http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html
+dnl https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html
dnl but this test verifies the guarantee regardless of TPS and regardless of
dnl scheduling policy.
-dnl Glibc currently does not provide this guarantee, see
+dnl Glibc does not provide this guarantee (and never will on Linux), see
dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701
+dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052
AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER],
[
AC_REQUIRE([gl_THREADLIB_EARLY])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader],
[gl_cv_pthread_rwlock_rdlock_prefer_writer],
[save_LIBS="$LIBS"
@@ -153,7 +155,25 @@ main ()
]])],
[gl_cv_pthread_rwlock_rdlock_prefer_writer=yes],
[gl_cv_pthread_rwlock_rdlock_prefer_writer=no],
- [gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes"])
+ [case "$host_os" in
+ # Guess no on glibc systems.
+ *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;;
+ # Guess no on musl systems.
+ *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;;
+ # Guess no on bionic systems.
+ *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;;
+ # Guess yes on native Windows with the mingw-w64 winpthreads library.
+ # Guess no on native Windows with the gnulib windows-rwlock module.
+ mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
+ gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes"
+ else
+ gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no"
+ fi
+ ;;
+ # If we don't know, obey --enable-cross-guesses.
+ *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;;
+ esac
+ ])
LIBS="$save_LIBS"
])
case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in