public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] linuxthreads pthread_cond_t
@ 2003-01-02 18:03 Jakub Jelinek
  2003-01-02 19:37 ` Roland McGrath
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2003-01-02 18:03 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

pthread_cond_t in NPTL wants long long alignment, so linuxthreads
should do the same, otherwise on 32-bit arches where
__alignof(long long) > 4 binaries/libs compiled against linuxthreads
-lpthread might not work with NPTL libs.
Haven't used __attribute__((aligned (__alignof__ (long long))))
to cope with non-GCC compilers.

2003-01-02  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/pthread/bits/pthreadtypes.h (__pthread_cond_align_t): New
	type.
	(pthread_cond_t): Add __align member, shorten __padding.
	* sysdeps/pthread/pthread.h (PHTREAD_COND_INITIALIZER): Initialize
	__padding and __align too.

--- libc/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h.jj	2003-01-02 14:49:58.000000000 +0100
+++ libc/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h	2003-01-02 19:57:25.000000000 +0100
@@ -53,12 +53,20 @@ typedef struct __pthread_attr_s
 
 
 /* Conditions (not abstract because of PTHREAD_COND_INITIALIZER */
+
+#ifdef __GLIBC_HAVE_LONG_LONG
+__extension__ typedef long long __pthread_cond_align_t;
+#else
+typedef long __pthread_cond_align_t;
+#endif
+
 typedef struct
 {
   struct _pthread_fastlock __c_lock; /* Protect against concurrent access */
   _pthread_descr __c_waiting;        /* Threads waiting on this condition */
   char __padding[48 - sizeof (struct _pthread_fastlock)
-		 - sizeof (_pthread_descr)];
+		 - sizeof (_pthread_descr) - sizeof (__pthread_cond_align_t)];
+  __pthread_cond_align_t __align;
 } pthread_cond_t;
 
 
--- libc/linuxthreads/sysdeps/pthread/pthread.h.jj	2002-06-05 10:27:29.000000000 +0200
+++ libc/linuxthreads/sysdeps/pthread/pthread.h	2003-01-02 20:20:34.000000000 +0100
@@ -41,7 +41,7 @@ __BEGIN_DECLS
   {0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __LOCK_INITIALIZER}
 #endif
 
-#define PTHREAD_COND_INITIALIZER {__LOCK_INITIALIZER, 0}
+#define PTHREAD_COND_INITIALIZER {__LOCK_INITIALIZER, 0, "", 0}
 
 #ifdef __USE_UNIX98
 # define PTHREAD_RWLOCK_INITIALIZER \

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-01-02 19:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-02 18:03 [PATCH] linuxthreads pthread_cond_t Jakub Jelinek
2003-01-02 19:37 ` Roland McGrath
2003-01-02 19:43   ` Ulrich Drepper
2003-01-02 19:43   ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).