This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Add __PTHREAD_RWLOCK_INT_FLAGS_SHARED
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 11 May 2012 07:37:29 -0700
- Subject: PATCH: Add __PTHREAD_RWLOCK_INT_FLAGS_SHARED
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
This patch adds __PTHREAD_RWLOCK_INT_FLAGS_SHARED so that x32 can
use the same PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP as
64-bit targets. Tested on Linux/x86-64/x32/ia32. OK to install?
Thanks.
H.J.
---
* sysdeps/pthread/pthread.h (__PTHREAD_RWLOCK_INT_FLAGS_SHARED):
New.
(PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP): Check
__PTHREAD_RWLOCK_INT_FLAGS_SHARED instead of __WORDSIZE.
diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
index bd97e85..8f10c87 100644
--- a/nptl/sysdeps/pthread/pthread.h
+++ b/nptl/sysdeps/pthread/pthread.h
@@ -118,11 +118,17 @@ enum
PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
};
+#ifndef __PTHREAD_RWLOCK_INT_FLAGS_SHARED
+# if __WORDSIZE == 64
+# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
+# endif
+#endif
+
/* Read-write lock initializers. */
# define PTHREAD_RWLOCK_INITIALIZER \
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
# ifdef __USE_GNU
-# if __WORDSIZE == 64
+# ifdef __PTHREAD_RWLOCK_INT_FLAGS_SHARED
# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }