Commit 49a0828d authored by Bruno Haible's avatar Bruno Haible
Browse files

pthread-thread, lock: On z/OS, use PTHREAD_RWLOCK_INITIALIZER_NP.

Reported by Daniel Richard G. in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00001.html>
<https://lists.gnu.org/archive/html/bug-gnulib/2019-12/msg00167.html>

* lib/pthread.in.h (PTHREAD_RWLOCK_INITIALIZER): Define to
PTHREAD_RWLOCK_INITIALIZER_NP when possible.
* lib/glthread/lock.h: Allow PTHREAD_RWLOCK_INITIALIZER_NP as an
alternative to PTHREAD_RWLOCK_INITIALIZER.
* lib/glthread/lock.c: Likewise.
parent 80d13fd5
2019-12-21 Bruno Haible <bruno@clisp.org>
pthread-thread, lock: On z/OS, use PTHREAD_RWLOCK_INITIALIZER_NP.
Reported by Daniel Richard G. in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00001.html>
<https://lists.gnu.org/archive/html/bug-gnulib/2019-12/msg00167.html>
* lib/pthread.in.h (PTHREAD_RWLOCK_INITIALIZER): Define to
PTHREAD_RWLOCK_INITIALIZER_NP when possible.
* lib/glthread/lock.h: Allow PTHREAD_RWLOCK_INITIALIZER_NP as an
alternative to PTHREAD_RWLOCK_INITIALIZER.
* lib/glthread/lock.c: Likewise.
2019-12-21 Bruno Haible <bruno@clisp.org>
 
memcmp tests: Work around the clang bug.
......@@ -254,7 +254,7 @@ glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1)))
# ifdef PTHREAD_RWLOCK_INITIALIZER
# if defined PTHREAD_RWLOCK_INITIALIZER || defined PTHREAD_RWLOCK_INITIALIZER_NP
# if !HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER
/* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */
......
......@@ -308,7 +308,7 @@ typedef pthread_mutex_t gl_lock_t;
# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1)))
# ifdef PTHREAD_RWLOCK_INITIALIZER
# if defined PTHREAD_RWLOCK_INITIALIZER || defined PTHREAD_RWLOCK_INITIALIZER_NP
typedef pthread_rwlock_t gl_rwlock_t;
# define gl_rwlock_define(STORAGECLASS, NAME) \
......@@ -316,8 +316,13 @@ typedef pthread_rwlock_t gl_rwlock_t;
# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
STORAGECLASS pthread_rwlock_t NAME = gl_rwlock_initializer;
# if HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER
# define gl_rwlock_initializer \
PTHREAD_RWLOCK_INITIALIZER
# if defined PTHREAD_RWLOCK_INITIALIZER
# define gl_rwlock_initializer \
PTHREAD_RWLOCK_INITIALIZER
# else
# define gl_rwlock_initializer \
PTHREAD_RWLOCK_INITIALIZER_NP
# endif
# define glthread_rwlock_init(LOCK) \
(pthread_in_use () ? pthread_rwlock_init (LOCK, NULL) : 0)
# else /* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */
......
......@@ -281,7 +281,11 @@ typedef unsigned int pthread_rwlockattr_t;
# define PTHREAD_RWLOCK_INITIALIZER \
{ PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
#else
# if !@HAVE_PTHREAD_T@
# if @HAVE_PTHREAD_T@
# if !defined PTHREAD_RWLOCK_INITIALIZER && defined PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */
# define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP
# endif
# else
# if !GNULIB_defined_pthread_rwlock_types
typedef int pthread_rwlock_t;
typedef unsigned int pthread_rwlockattr_t;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment