From be8efac78d067c138ad8dda03df4336e73f94887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 8 Jan 2022 11:51:07 +0100 Subject: New upstream version 1.0 --- gnulib-m4/pthread_rwlock_rdlock.m4 | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'gnulib-m4/pthread_rwlock_rdlock.m4') diff --git a/gnulib-m4/pthread_rwlock_rdlock.m4 b/gnulib-m4/pthread_rwlock_rdlock.m4 index 9c1d5d01..8ad78392 100644 --- a/gnulib-m4/pthread_rwlock_rdlock.m4 +++ b/gnulib-m4/pthread_rwlock_rdlock.m4 @@ -1,5 +1,5 @@ -# pthread_rwlock_rdlock.m4 serial 1 -dnl Copyright (C) 2017-2018 Free Software Foundation, Inc. +# pthread_rwlock_rdlock.m4 serial 4 +dnl Copyright (C) 2017-2022 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. @@ -23,15 +23,19 @@ dnl time, a phenomenon called "writer starvation". dnl Without such a guarantee, applications have a hard time avoiding writer dnl starvation. dnl -dnl POSIX:2008 makes this requirement only for implementations that support TPS +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 but test verifies the guarantee regardless of TPS and regardless of +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 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" @@ -151,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 -- cgit v1.2.3