This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC/PATCH] RT-NPTL-2.2 5/5


 nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S |   20 
 nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S    |   20 
 nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S |   20 
 nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S      |   20 
 nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S |   20 
 nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S    |   20 
 nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S |   21
-
 nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S      |   20 
 nptl/sysdeps/unix/sysv/linux/ia64/bits/posix_opt.h              |    9 
 nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h                |  146
+++++++
 nptl/sysdeps/unix/sysv/linux/ia64/pthread_cond_broadcast.c      |    2 
 nptl/sysdeps/unix/sysv/linux/ia64/pthread_cond_signal.c         |    2 
 nptl/sysdeps/unix/sysv/linux/ia64/pthread_cond_timedwait.c      |    2 
 nptl/sysdeps/unix/sysv/linux/ia64/pthread_cond_wait.c           |    2 
 nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h             |  129
++++++
 nptl/sysdeps/unix/sysv/linux/powerpc/pthread_cond_broadcast.c   |   87
++++
 nptl/sysdeps/unix/sysv/linux/powerpc/pthread_cond_signal.c      |   69
+++
 nptl/sysdeps/unix/sysv/linux/powerpc/pthread_cond_timedwait.c   |  204
++++++++++
 nptl/sysdeps/unix/sysv/linux/powerpc/pthread_cond_wait.c        |  167
++++++++
 sysdeps/generic/bits/confname.h                                 |    4 
 sysdeps/posix/sysconf.c                                         |    6 
 21 files changed, 826 insertions(+), 164 deletions(-)

---
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_
cond_broadcast.S:1.1.1.1	Thu Oct  9 06:54:44 2003
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_
cond_broadcast.S	Thu Apr 29 09:10:11 2004
@@ -1,20 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "../i486/pthread_cond_broadcast.S"
---
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_
cond_signal.S:1.1.1.1	Thu Oct  9 06:54:44 2003
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_
cond_signal.S	Thu Apr 29 09:10:11 2004
@@ -1,20 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "../i486/pthread_cond_signal.S"
---
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_
cond_timedwait.S:1.1.1.1	Thu Oct  9 06:54:44 2003
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_
cond_timedwait.S	Thu Apr 29 09:10:11 2004
@@ -1,20 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "../i486/pthread_cond_timedwait.S"
---
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_
cond_wait.S:1.1.1.1	Thu Oct  9 06:54:44 2003
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i586/pthread_
cond_wait.S	Thu Apr 29 09:10:11 2004
@@ -1,20 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "../i486/pthread_cond_wait.S"
---
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_
cond_broadcast.S:1.1.1.1	Thu Oct  9 06:54:44 2003
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_
cond_broadcast.S	Thu Apr 29 09:10:11 2004
@@ -1,20 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "../i486/pthread_cond_broadcast.S"
---
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_
cond_signal.S:1.1.1.1	Thu Oct  9 06:54:44 2003
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_
cond_signal.S	Thu Apr 29 09:10:11 2004
@@ -1,20 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "../i486/pthread_cond_signal.S"
---
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_
cond_timedwait.S:1.1.1.1	Thu Oct  9 06:54:44 2003
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_
cond_timedwait.S	Thu Apr 29 09:10:11 2004
@@ -1,21 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define HAVE_CMOV 1
-#include "../i486/pthread_cond_timedwait.S"
---
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_
cond_wait.S:1.1.1.1	Thu Oct  9 06:54:44 2003
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_
cond_wait.S	Thu Apr 29 09:10:11 2004
@@ -1,20 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "../i486/pthread_cond_wait.S"
---
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.
h:1.1.1.1.2.2	Fri Mar 26 02:41:44 2004
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.
h	Tue Apr 13 11:37:07 2004
@@ -2,6 +2,10 @@
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
+   Redirect lowlevellock to use Fast User SYNchronization(fusyn). 
+   Based on implementation for i386 by Boris Hu (Intel).
+   Dave Howell <david.p.howell@intel.com>, 2003
+   
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
@@ -119,6 +123,7 @@
 #define lll_mutex_unlock(futex) \
   __lll_mutex_unlock(&(futex))
 
+//#warning FIXME: requeue feature will be added when the fusyn is
ready. 
 
 #define __lll_mutex_unlock_force(futex)		\
   ((void) ({					\
@@ -197,5 +202,146 @@
   __lll_cond_wake (cond)
 #define lll_cond_broadcast(cond) \
   __lll_cond_broadcast (cond)
+
+// USE_FUSYN_ROBUST_MUTEX macro to enable/disable the RM features.
+#define USE_FUSYN_ROBUST_MUTEX  1
+
+#ifdef  USE_FUSYN_ROBUST_MUTEX
+
+#include <linux/fulock.h>
+#include <sysdep.h>
+#include <errno.h>
+#include <pthread.h>
+#include <internaltypes.h>
+
+#ifndef __set_errno
+#define __set_errno(e) (errno = (e))
+#endif
+
+//#define SEA_DEBUG       1  // To Enable the debug info
+
+#ifdef SEA_DEBUG
+int printf(const char *format, ...); 	/* To make GCC happy */
+
+/* Indicate location */
+#  define SEA_L
\
+       do {
\
+                unsigned id = THREAD_GETMEM (THREAD_SELF, tid);
\
+                printf("[%d] %s:%s() %d line: \n", id, __FILE__,
\
+                       __FUNCTION__, __LINE__);
\
+        } while (0)
+
+/* Location-aware printf */
+#  define SEA_P(fmt, args...)
\
+        do {
\
+                unsigned id = THREAD_GETMEM (THREAD_SELF, tid);
\
+                printf("[%d] %s:%s() %d line: " fmt "\n",
\
+                        id, __FILE__,__FUNCTION__,__LINE__,args);
\
+        } while (0)
+                                
+#else
+#  define SEA_L
+#  define SEA_P(fmt, args...)
+#endif 
+
+/* Add lll_rtmutex_* to support fusyn */
+#define FUSYN_FL_RT_MASK        (0x78000000 | FULOCK_FASTPATH_MODE |
\
+                                 FULOCK_SERIAL_MODE | PRIOCEILING_MASK)
+#define FUSYN_FL_RT2K_MASK      (0x78000000 | FULOCK_FASTPATH_MODE)
+#define MUTEX_OFF_KIND		3
+
+/*  Get fusyn flags. */
+#define __LK_FL(mutex)
\
+        ({ unsigned k_flags;
\
+           unsigned flags =((pthread_mutex_t *)(mutex))->__data.__kind
\
+                                & FUSYN_FL_RT2K_MASK;
\
+           k_flags = ((flags << 1) & FULOCK_FL_USER_MK);
\
+           k_flags;})
+
+/*  Get rtnptl flags. */
+#define __RT_FL(fulock)
\
+ ({ unsigned flags = ((pthread_mutex_t *)(fulock))->__data.__kind
\
+                     & FUSYN_FL_RT_MASK;
\
+    flags;})
+
+extern int is_mutex_robust(const pthread_mutex_t *mutex);
+
+extern int __lll_rtmutex_trylock (volatile unsigned *vfulock, unsigned
tid);
+#define lll_rtmutex_trylock(futex, tid) __lll_rtmutex_trylock(&(futex),
tid)
+
+
+extern int __lll_rtmutex_timedlock (volatile unsigned *vfulock,
unsigned flags,
+                                    unsigned tid, const struct timespec
*rel);
+#define lll_rtmutex_timedlock(futex, tid, timeout) \
+        __lll_rtmutex_timedlock(&(futex), __LK_FL(&(futex)), tid,
timeout)
+
+
+extern int __lll_rtmutex_lock (volatile unsigned *vfulock, unsigned
flags,
+                               unsigned tid);
+#define lll_rtmutex_lock(futex, tid) \
+        __lll_rtmutex_lock(&(futex), __LK_FL(&(futex)), tid)
+
+
+extern int __lll_rtmutex_unlock (volatile unsigned *vfulock, unsigned
flags,
+                                 unsigned tid);
+#define lll_rtmutex_unlock(futex, tid) \
+        __lll_rtmutex_unlock(&(futex), __LK_FL(&(futex)), tid)
+
+
+extern int __lll_rtmutex_unlock_nocheck (volatile unsigned *vfulock);
+#define lll_rtmutex_unlock_nocheck(futex) \
+        __lll_rtmutex_unlock_nocheck(&(futex))
+
+
+extern int __lll_rtmutex_set_consistency (volatile unsigned *vfulock,
+                                          enum fulock_ctl consistency)
;
+#define lll_rtmutex_set_consistency(futex, state) \
+        __lll_rtmutex_set_consistency(&(futex), state)
+
+
+extern int __lll_rtmutex_get_consistency (volatile unsigned *vfulock,
+                                          int *state);
+#define lll_rtmutex_get_consistency(futex, state) \
+        __lll_rtmutex_get_consistency(&(futex), state)
+
+
+#define CONDVAR_RM_FLAGS        FULOCK_FL_RM
+
+#define lll_cmutex_lock(fulock, id)   \
+  do {
\
+        while (__lll_rtmutex_lock(&(fulock), CONDVAR_RM_FLAGS, id))
\
+                lll_rtmutex_set_consistency(fulock,
\
+                       PTHREAD_MUTEX_ROBUST_CONSISTENT_NP);
\
+  } while (0)
+          
+#define lll_cmutex_unlock(fulock, id) \
+        __lll_rtmutex_unlock(&(fulock), CONDVAR_RM_FLAGS, id)
+
+#define LLL_CMUTEX_LOCK(mutex, tid)     \
+        lll_cmutex_lock (mutex, tid)
+
+#define LLL_CMUTEX_UNLOCK(mutex, tid)   \
+        lll_cmutex_unlock (mutex, tid)
+#else  /* Normal NPTL */
+
+#define FUSYN_FL_RT_MASK        0
+
+#define LLL_CMUTEX_LOCK(mutex, tid)     \
+        lll_mutex_lock(mutex)
+
+#define LLL_CMUTEX_UNLOCK(mutex, tid)   \
+        lll_mutex_unlock (mutex)
+
+#define lll_rtmutex_get_consistency(futex, state) 0
+
+#define lll_rtmutex_set_consistency(futex, state) 0
+
+#define lll_rtmutex_unlock_nocheck(futex) 0
+
+#define __LK_FL(fulock) 0
+
+     
+#endif /* USE_FUSYN_ROBUST_MUTEX */
+
 
 #endif	/* lowlevellock.h */
--- /dev/null	Thu Apr 29 09:10:11 2004
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/ia64/pthread_cond_
broadcast.c	Tue Mar 30 09:20:36 2004
@@ -0,0 +1,2 @@
+
+#include "../i386/pthread_cond_broadcast.c"
--- /dev/null	Thu Apr 29 09:10:11 2004
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/ia64/pthread_cond_
signal.c	Tue Mar 30 09:20:36 2004
@@ -0,0 +1,2 @@
+
+#include "../i386/pthread_cond_signal.c"
--- /dev/null	Thu Apr 29 09:10:11 2004
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/ia64/pthread_cond_
timedwait.c	Tue Mar 30 09:20:36 2004
@@ -0,0 +1,2 @@
+
+#include "../i386/pthread_cond_timedwait.c"
--- /dev/null	Thu Apr 29 09:10:11 2004
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/ia64/pthread_cond_
wait.c	Tue Mar 30 09:20:36 2004
@@ -0,0 +1,2 @@
+
+#include "../i386/pthread_cond_wait.c"
---
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/ia64/bits/posix_op
t.h:1.1.1.1.2.1	Tue Apr 13 03:40:43 2004
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/ia64/bits/posix_op
t.h	Tue Apr 13 03:56:02 2004
@@ -144,4 +144,13 @@
 /* The clock selection interfaces are available.  */
 #define _POSIX_CLOCK_SELECTION	200112L
 
+/* The Priority Inheritence of thread is available. */
+#define _POSIX_THREAD_PRIO_INHERIT 1
+
+/* The Priority Protect of thread is available. */
+#define _POSIX_THREAD_PRIO_PROTECT 2
+
+/* The robust mutex is available. */
+#define _POSIX_THREAD_ROBUST_MUTEX_NP 1
+
 #endif /* posix_opt.h */
---
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevello
ck.h:1.1.1.1.2.2	Mon Apr  5 01:35:54 2004
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevello
ck.h	Tue Apr 13 11:37:08 2004
@@ -49,8 +49,8 @@
     INTERNAL_SYSCALL_DECL (__err);
\
     long int __ret;
\
 
\
-    __ret = INTERNAL_SYSCALL (futex, __err, 4,
\
-			      (futexp), FUTEX_WAIT, (val), (timespec));
\
+    __ret = INTERNAL_SYSCALL (futex, __err, 5,
\
+			      (futexp), FUTEX_WAIT, (val), (timespec),
0);	      \
     INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret;
\
   })
 
@@ -233,5 +233,130 @@
   __lll_cond_wake (cond)
 #define lll_cond_broadcast(cond) \
   __lll_cond_broadcast (cond)
+
+#include <linux/fulock.h>
+
+#ifdef  USE_FUSYN_ROBUST_MUTEX
+//#define SEA_DEBUG       1  // To Enable the debug info
+#ifdef SEA_DEBUG
+/* Indicate location */
+#  define SEA_L
\
+       do {
\
+                unsigned id = THREAD_GETMEM (THREAD_SELF, tid);
\
+                printf("[%d] %s:%s() %d line: \n", id, __FILE__,
\
+                       __FUNCTION__, __LINE__);
\
+        } while (0)
+
+/* Location-aware printf */
+#  define SEA_P(fmt, args...)
\
+        do {
\
+                unsigned id = THREAD_GETMEM (THREAD_SELF, tid);
\
+                printf("[%d] %s:%s() %d line: " fmt "\n",
\
+                        id, __FILE__,__FUNCTION__,__LINE__,args);
\
+        } while (0)
+                                
+#else
+#  define SEA_L
+#  define SEA_P(fmt, args...)
+#endif 
+
+/*  Add lll_rtmutex_* to support fusyn */
+#define FUSYN_FL_RT_MASK        (0x78000000 | FULOCK_FASTPATH_MODE |
\
+                                 FULOCK_SERIAL_MODE | PRIOCEILING_MASK)
+#define FUSYN_FL_RT2K_MASK      (0x78000000 | FULOCK_FASTPATH_MODE)
+/*  Get fusyn flags. */
+#define __LK_FL(fulock)
\
+ ({ unsigned k_flags = 0;
\
+    unsigned flags = ((pthread_mutex_t *)(fulock))->__data.__kind
\
+                     & FUSYN_FL_RT2K_MASK;
\
+    k_flags = ((flags << 1) & FULOCK_FL_USER_MK);
\
+    k_flags;})
+/*  Get rtnptl flags. */
+#define __RT_FL(fulock)
\
+ ({ unsigned flags = ((pthread_mutex_t *)(fulock))->__data.__kind
\
+                     & FUSYN_FL_RT_MASK;
\
+    flags;})
+    
+
+extern int is_mutex_robust(const pthread_mutex_t *mutex);
+
+extern int __lll_rtmutex_trylock (volatile unsigned *vfulock, unsigned
tid);
+#define lll_rtmutex_trylock(futex, tid) __lll_rtmutex_trylock(&(futex),
tid)
+
+
+extern int __lll_rtmutex_timedlock (volatile unsigned *vfulock,
unsigned flags,
+                                    unsigned tid, struct timespec
*rel);
+#define lll_rtmutex_timedlock(futex, tid, timeout) \
+        __lll_rtmutex_timedlock(&(futex), __LK_FL(&(futex)), tid,
timeout)
+
+
+extern int __lll_rtmutex_lock (volatile unsigned *vfulock, unsigned
flags,
+                               unsigned tid);
+#define lll_rtmutex_lock(futex, tid) \
+        __lll_rtmutex_lock(&(futex), __LK_FL(&(futex)), tid)
+
+
+extern int __lll_rtmutex_unlock (volatile unsigned *vfulock, unsigned
flags,
+                                 unsigned tid);
+#define lll_rtmutex_unlock(futex, tid) \
+        __lll_rtmutex_unlock(&(futex), __LK_FL(&(futex)), tid)
+
+
+extern int __lll_rtmutex_unlock_nocheck (volatile unsigned *vfulock);
+#define lll_rtmutex_unlock_nocheck(futex) \
+        __lll_rtmutex_unlock_nocheck(&(futex))
+
+
+extern int __lll_rtmutex_set_consistency (volatile unsigned *vfulock,
+                                          enum fulock_con consistency)
;
+#define lll_rtmutex_set_consistency(futex, state) \
+        __lll_rtmutex_set_consistency(&(futex), state)
+
+
+extern int __lll_rtmutex_get_consistency (volatile unsigned *vfulock,
+                                          int *state);
+#define lll_rtmutex_get_consistency(futex, state) \
+        __lll_rtmutex_get_consistency(&(futex), state)
+
+
+#define CONDVAR_RM_FLAGS        FULOCK_FL_RM
+
+#define lll_cmutex_lock(fulock, id)   \
+  do {
\
+        while (__lll_rtmutex_lock(&(fulock), CONDVAR_RM_FLAGS, id))
\
+                lll_rtmutex_set_consistency(fulock,
\
+                       PTHREAD_MUTEX_ROBUST_CONSISTENT_NP);
\
+  } while (0)
+          
+#define lll_cmutex_unlock(fulock, id) \
+        __lll_rtmutex_unlock(&(fulock), CONDVAR_RM_FLAGS, id)
+
+#define LLL_CMUTEX_LOCK(mutex, tid)     \
+        lll_cmutex_lock (mutex, tid)
+
+#define LLL_CMUTEX_UNLOCK(mutex, tid)   \
+        lll_cmutex_unlock (mutex, tid)
+
+#else  /* Normal NPTL */
+
+#define FUSYN_FL_RT_MASK        0
+
+#define LLL_CMUTEX_LOCK(mutex, tid)     \
+        lll_mutex_lock(mutex)
+
+#define LLL_CMUTEX_UNLOCK(mutex, tid)   \
+        lll_mutex_unlock (mutex)
+
+#define lll_rtmutex_get_consistency(futex, state) 0
+
+#define lll_rtmutex_set_consistency(futex, state) 0
+
+#define lll_rtmutex_unlock_nocheck(futex) 0
+
+#define __LK_FL(fulock) 0
+#define __RT_FL(fulock) 0
+
+#endif /* USE_FUSYN_ROBUST_MUTEX */
+
 
 #endif	/* lowlevellock.h */
--- /dev/null	Thu Apr 29 09:10:12 2004
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_co
nd_broadcast.c	Tue Mar 30 09:20:39 2004
@@ -0,0 +1,87 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
+
+   Hacked to add robust featuers to condvar by
+   Boris Hu <boris.hu@intel.com>, 2003.
+   
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <endian.h>
+#include <errno.h>
+#include <sysdep.h>
+#include <lowlevellock.h>
+#include <pthread.h>
+#include <pthreadP.h>
+
+#include <shlib-compat.h>
+#include <kernel-features.h>
+
+
+int
+__pthread_cond_broadcast (cond)
+     pthread_cond_t *cond;
+{
+  pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
+
+  /* Make sure we are alone.  */
+  LLL_CMUTEX_LOCK (cond->__data.__lock, id);
+
+  /* Are there any waiters to be woken?  */
+  if (cond->__data.__total_seq > cond->__data.__wakeup_seq)
+    {
+      /* Yes.  Mark them all as woken.  */
+      cond->__data.__wakeup_seq = cond->__data.__total_seq;
+
+      /* We are done.  */
+      LLL_CMUTEX_UNLOCK (cond->__data.__lock, id);
+
+      /* The futex syscall operates on a 32-bit word.  That is fine,
+	 we just use the low 32 bits of the sequence counter.  */
+#if BYTE_ORDER == LITTLE_ENDIAN
+      int *futex = ((int *) (&cond->__data.__wakeup_seq));
+#elif BYTE_ORDER == BIG_ENDIAN
+      int *futex = ((int *) (&cond->__data.__wakeup_seq)) + 1;
+#else
+# error "No valid byte order"
+#endif
+
+      /* Do not use requeue for pshared condvars.  */
+      if (cond->__data.__mutex == (void *) ~0l)
+	goto wake_all;
+      
+      /* Wake everybody.  */
+      pthread_mutex_t *mut = (pthread_mutex_t *) cond->__data.__mutex;
+      if (__builtin_expect (lll_futex_requeue (futex, 1, INT_MAX,
+					       &mut->__data.__lock) ==
-EINVAL,
+			    0))
+	{
+	  /* The requeue functionality is not available.  */
+        wake_all:
+	  lll_futex_wake (futex, INT_MAX);
+	}
+
+      /* That's all.  */
+      return 0;
+    }
+
+  /* We are done.  */
+  LLL_CMUTEX_UNLOCK (cond->__data.__lock, id);
+  return 0;
+}
+
+versioned_symbol (libpthread, __pthread_cond_broadcast,
pthread_cond_broadcast,
+		  GLIBC_2_3_2);
--- /dev/null	Thu Apr 29 09:10:12 2004
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_co
nd_signal.c	Tue Mar 30 09:20:39 2004
@@ -0,0 +1,69 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
+
+   Hacked to add robust featuers to condvar by
+   Boris Hu <boris.hu@intel.com>, 2003.
+   
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <endian.h>
+#include <errno.h>
+#include <sysdep.h>
+#include <lowlevellock.h>
+#include <pthread.h>
+#include <pthreadP.h>
+
+#include <shlib-compat.h>
+#include <kernel-features.h>
+
+
+int
+__pthread_cond_signal (cond)
+     pthread_cond_t *cond;
+{
+  pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
+
+  /* Make sure we are alone.  */
+  LLL_CMUTEX_LOCK (cond->__data.__lock, id);
+
+  /* Are there any waiters to be woken?  */
+  if (cond->__data.__total_seq > cond->__data.__wakeup_seq)
+    {
+      /* Yes.  Mark one of them as woken.  */
+      ++cond->__data.__wakeup_seq;
+
+      /* The futex syscall operates on a 32-bit word.  That is fine,
+	 we just use the low 32 bits of the sequence counter.  */
+#if BYTE_ORDER == LITTLE_ENDIAN
+      int *futex = ((int *) (&cond->__data.__wakeup_seq));
+#elif BYTE_ORDER == BIG_ENDIAN
+      int *futex = ((int *) (&cond->__data.__wakeup_seq)) + 1;
+#else
+# error "No valid byte order"
+#endif
+
+      /* Wake one.  */
+      lll_futex_wake (futex, 1);
+    }
+
+  /* We are done.  */
+  LLL_CMUTEX_UNLOCK (cond->__data.__lock, id);
+  return 0;
+}
+
+versioned_symbol (libpthread, __pthread_cond_signal,
pthread_cond_signal,
+		  GLIBC_2_3_2);
--- /dev/null	Thu Apr 29 09:10:12 2004
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_co
nd_timedwait.c	Tue Mar 30 09:20:39 2004
@@ -0,0 +1,204 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
+
+   Hacked to add robust featuers to condvar by
+   Boris Hu <boris.hu@intel.com>, 2003.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <endian.h>
+#include <errno.h>
+#include <sysdep.h>
+#include <lowlevellock.h>
+#include <pthread.h>
+#include <pthreadP.h>
+
+#include <shlib-compat.h>
+
+
+/* Cleanup handler, defined in pthread_cond_wait.c.  */
+extern void __condvar_cleanup (void *arg)
+     __attribute__ ((visibility ("hidden")));
+
+struct _condvar_cleanup_buffer
+{
+  int oldtype;
+  pthread_cond_t *cond;
+  pthread_mutex_t *mutex;
+};
+
+int
+__pthread_cond_timedwait (cond, mutex, abstime)
+     pthread_cond_t *cond;
+     pthread_mutex_t *mutex;
+     const struct timespec *abstime;
+{
+  struct _pthread_cleanup_buffer buffer;
+  struct _condvar_cleanup_buffer cbuffer;
+  int result = 0;
+  pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
+ 
+  /* Catch invalid parameters.  */
+  if (abstime->tv_nsec >= 1000000000)
+    return EINVAL;
+
+  /* Make sure we are along.  */
+  LLL_CMUTEX_LOCK (cond->__data.__lock, id);
+
+  /* Now we can release the mutex.  */
+  int err = __pthread_mutex_unlock_usercnt (mutex, 0);
+  if (err)
+    {
+      LLL_CMUTEX_UNLOCK (cond->__data.__lock, id);
+      return err;
+    }
+
+  /* We have one new user of the condvar.  */
+  ++cond->__data.__total_seq;
+
+  /* Remember the mutex we are using here.  If there is already a
+     different address store this is a bad user bug.  Do not store
+     anything for pshared condvars.  */
+  if (cond->__data.__mutex != (void *) ~0l)
+    cond->__data.__mutex = mutex;
+  
+  /* Prepare structure passed to cancellation handler.  */
+  cbuffer.cond = cond;
+  cbuffer.mutex = mutex;
+
+  /* Before we block we enable cancellation.  Therefore we have to
+     install a cancellation handler.  */
+  __pthread_cleanup_push (&buffer, __condvar_cleanup, &cbuffer);
+
+  /* The current values of the wakeup counter.  The "woken" counter
+     must exceed this value.  */
+  unsigned long long int val;
+  unsigned long long int seq;
+  val = seq = cond->__data.__wakeup_seq;
+
+  /* The futex syscall operates on a 32-bit word.  That is fine, we
+     just use the low 32 bits of the sequence counter.  */
+#if BYTE_ORDER == LITTLE_ENDIAN
+  int *futex = ((int *) (&cond->__data.__wakeup_seq));
+#elif BYTE_ORDER == BIG_ENDIAN
+  int *futex = ((int *) (&cond->__data.__wakeup_seq)) + 1;
+#else
+# error "No valid byte order"
+#endif
+
+  while (1)
+    {
+      struct timespec rt;
+      {
+#ifdef __NR_clock_gettime
+	INTERNAL_SYSCALL_DECL (err);
+	int val;
+	val = INTERNAL_SYSCALL (clock_gettime, err, 2,
+				cond->__data.__clock, &rt);
+# ifndef __ASSUME_POSIX_TIMERS
+	if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (val, err), 0))
+	  {
+	    struct timeval tv;
+	    (void) gettimeofday (&tv, NULL);
+
+	    /* Convert the absolute timeout value to a relative timeout.
*/
+	    rt.tv_sec = abstime->tv_sec - tv.tv_sec;
+	    rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000;
+	  }
+	else
+# endif
+	  {
+	    /* Convert the absolute timeout value to a relative timeout.
*/
+	    rt.tv_sec = abstime->tv_sec - rt.tv_sec;
+	    rt.tv_nsec = abstime->tv_nsec - rt.tv_nsec;
+	  }
+#else
+	/* Get the current time.  So far we support only one clock.  */
+	struct timeval tv;
+	(void) gettimeofday (&tv, NULL);
+
+	/* Convert the absolute timeout value to a relative timeout.  */
+	rt.tv_sec = abstime->tv_sec - tv.tv_sec;
+	rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000;
+#endif
+      }
+      if (rt.tv_nsec < 0)
+	{
+	  rt.tv_nsec += 1000000000;
+	  --rt.tv_sec;
+	}
+      /* Did we already time out?  */
+      if (rt.tv_sec < 0)
+	{
+	  /* Yep.  Adjust the sequence counter.  */
+	  ++cond->__data.__wakeup_seq;
+
+	  /* The error value.  */
+	  result = ETIMEDOUT;
+	  break;
+	}
+
+      /* Prepare to wait.  Release the condvar futex.  */
+      LLL_CMUTEX_UNLOCK (cond->__data.__lock, id);
+
+      /* Enable asynchronous cancellation.  Required by the standard.
*/
+      cbuffer.oldtype = __pthread_enable_asynccancel ();
+
+      /* Wait until woken by signal or broadcast.  Note that we
+	 truncate the 'val' value to 32 bits.  */
+      err = lll_futex_timed_wait (futex, (unsigned int) val, &rt);
+
+      /* Disable asynchronous cancellation.  */
+      __pthread_disable_asynccancel (cbuffer.oldtype);
+
+      /* We are going to look at shared data again, so get the lock.
*/
+      LLL_CMUTEX_LOCK (cond->__data.__lock, id);
+
+      /* Check whether we are eligible for wakeup.  */
+      val = cond->__data.__wakeup_seq;
+      if (val > seq && cond->__data.__woken_seq < val)
+	break;
+
+      /* Not woken yet.  Maybe the time expired?  */
+      if (err == -ETIMEDOUT)
+	{
+	  /* Yep.  Adjust the counters.  */
+	  ++cond->__data.__wakeup_seq;
+
+	  /* The error value.  */
+	  result = ETIMEDOUT;
+	  break;
+	}
+    }
+
+  /* Another thread woken up.  */
+  ++cond->__data.__woken_seq;
+
+  /* We are done with the condvar.  */
+  LLL_CMUTEX_UNLOCK (cond->__data.__lock, id);
+
+  /* The cancellation handling is back to normal, remove the handler.
*/
+  __pthread_cleanup_pop (&buffer, 0);
+
+  /* Get the mutex before returning.  */
+  err = __pthread_mutex_cond_lock (mutex);
+
+  return err ?: result;
+}
+
+versioned_symbol (libpthread, __pthread_cond_timedwait,
pthread_cond_timedwait,
+		  GLIBC_2_3_2);
--- /dev/null	Thu Apr 29 09:10:12 2004
+++
robustmutexes/rtnptl/src/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_co
nd_wait.c	Tue Mar 30 09:20:39 2004
@@ -0,0 +1,167 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
+
+   Hacked to add robust featuers to condvar by
+   Boris Hu <boris.hu@intel.com>, 2003.
+   
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <endian.h>
+#include <errno.h>
+#include <sysdep.h>
+#include <lowlevellock.h>
+#include <pthread.h>
+#include <pthreadP.h>
+
+#include <shlib-compat.h>
+
+
+struct _condvar_cleanup_buffer
+{
+  int oldtype;
+  pthread_cond_t *cond;
+  pthread_mutex_t *mutex;
+};
+
+
+void
+__attribute__ ((visibility ("hidden")))
+__condvar_cleanup (void *arg)
+{
+  struct _condvar_cleanup_buffer *cbuffer =
+    (struct _condvar_cleanup_buffer *) arg;
+  pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
+  
+  /* We are going to modify shared data.  */
+  LLL_CMUTEX_LOCK (cbuffer->cond->__data.__lock, id);
+  
+  /* This thread is not waiting anymore.  Adjust the sequence counters
+     appropriately.  */
+  ++cbuffer->cond->__data.__wakeup_seq;
+  ++cbuffer->cond->__data.__woken_seq;
+
+  /* We are done.  */
+  LLL_CMUTEX_UNLOCK (cbuffer->cond->__data.__lock, id);
+
+  /* Wake everybody to make sure no condvar signal gets lost.  */
+#if BYTE_ORDER == LITTLE_ENDIAN
+  int *futex = ((int *) (&cbuffer->cond->__data.__wakeup_seq));
+#elif BYTE_ORDER == BIG_ENDIAN
+  int *futex = ((int *) (&cbuffer->cond->__data.__wakeup_seq)) + 1;
+#else
+# error "No valid byte order"
+#endif
+  lll_futex_wake (futex, INT_MAX);
+
+  /* Get the mutex before returning unless asynchronous cancellation
+     is in effect.  */
+  __pthread_mutex_cond_lock (cbuffer->mutex);
+}
+
+
+int
+__pthread_cond_wait (cond, mutex)
+     pthread_cond_t *cond;
+     pthread_mutex_t *mutex;
+{
+  struct _pthread_cleanup_buffer buffer;
+  struct _condvar_cleanup_buffer cbuffer;
+  int err;
+  pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
+  
+  /* Make sure we are along.  */
+  LLL_CMUTEX_LOCK (cond->__data.__lock, id);
+
+  /* Now we can release the mutex.  */
+  err = __pthread_mutex_unlock_usercnt (mutex, 0);
+  if (err)
+    {
+      LLL_CMUTEX_UNLOCK (cond->__data.__lock, id);
+      return err;
+    }
+
+  /* We have one new user of the condvar.  */
+  ++cond->__data.__total_seq;
+
+  /* Remember the mutex we are using here.  If there is already a
+     different address store this is a bad user bug.  Do not store
+     anything for pshared condvars.  */
+  if (cond->__data.__mutex != (void *) ~0l)
+    cond->__data.__mutex = mutex;
+
+  /* Prepare structure passed to cancellation handler.  */
+  cbuffer.cond = cond;
+  cbuffer.mutex = mutex;
+
+  /* Before we block we enable cancellation.  Therefore we have to
+     install a cancellation handler.  */
+  __pthread_cleanup_push (&buffer, __condvar_cleanup, &cbuffer);
+
+  /* The current values of the wakeup counter.  The "woken" counter
+     must exceed this value.  */
+  unsigned long long int val;
+  unsigned long long int seq;
+  val = seq = cond->__data.__wakeup_seq;
+
+  /* The futex syscall operates on a 32-bit word.  That is fine, we
+     just use the low 32 bits of the sequence counter.  */
+#if BYTE_ORDER == LITTLE_ENDIAN
+  int *futex = ((int *) (&cond->__data.__wakeup_seq));
+#elif BYTE_ORDER == BIG_ENDIAN
+  int *futex = ((int *) (&cond->__data.__wakeup_seq)) + 1;
+#else
+# error "No valid byte order"
+#endif
+
+  do
+    {
+      /* Prepare to wait.  Release the condvar futex.  */
+      LLL_CMUTEX_UNLOCK (cond->__data.__lock, id);
+
+      /* Enable asynchronous cancellation.  Required by the standard.
*/
+      cbuffer.oldtype = __pthread_enable_asynccancel ();
+
+      /* Wait until woken by signal or broadcast.  Note that we
+	 truncate the 'val' value to 32 bits.  */
+      lll_futex_wait (futex, (unsigned int) val);
+
+      /* Disable asynchronous cancellation.  */
+      __pthread_disable_asynccancel (cbuffer.oldtype);
+
+      /* We are going to look at shared data again, so get the lock.
*/
+      LLL_CMUTEX_LOCK (cond->__data.__lock, id);
+
+      /* Check whether we are eligible for wakeup.  */
+      val = cond->__data.__wakeup_seq;
+    }
+  while (! (val > seq && cond->__data.__woken_seq < val));
+
+  /* Another thread woken up.  */
+  ++cond->__data.__woken_seq;
+
+  /* We are done with the condvar.  */
+  LLL_CMUTEX_UNLOCK (cond->__data.__lock, id);
+  
+  /* The cancellation handling is back to normal, remove the handler.
*/
+  __pthread_cleanup_pop (&buffer, 0);
+
+  /* Get the mutex before returning.  */
+  return __pthread_mutex_cond_lock (mutex);
+}
+
+versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
+		  GLIBC_2_3_2);
--- robustmutexes/rtnptl/src/sysdeps/generic/bits/confname.h:1.1.1.1.2.1
Fri Mar 26 02:42:11 2004
+++ robustmutexes/rtnptl/src/sysdeps/generic/bits/confname.h	Tue Mar
30 09:20:41 2004
@@ -492,9 +492,11 @@
 #define _SC_LEVEL4_CACHE_SIZE		_SC_LEVEL4_CACHE_SIZE
     _SC_LEVEL4_CACHE_ASSOC,
 #define _SC_LEVEL4_CACHE_ASSOC		_SC_LEVEL4_CACHE_ASSOC
-    _SC_LEVEL4_CACHE_LINESIZE
+    _SC_LEVEL4_CACHE_LINESIZE,
 #define _SC_LEVEL4_CACHE_LINESIZE	_SC_LEVEL4_CACHE_LINESIZE
     /* Leave room here, maybe we need a few more cache levels some day.
*/
+    _SC_THREAD_ROBUST_MUTEX_NP
+#define _SC_THREAD_ROBUST_MUTEX_NP      _SC_THREAD_ROBUST_MUTEX_NP
   };
 
 /* Values for the NAME argument to `confstr'.  */
--- robustmutexes/rtnptl/src/sysdeps/posix/sysconf.c:1.1.1.1.2.1
Fri Mar 26 02:42:28 2004
+++ robustmutexes/rtnptl/src/sysdeps/posix/sysconf.c	Tue Mar 30
09:20:41 2004
@@ -1183,6 +1183,12 @@
 	 return zero which indicates that no information is
 	 available.  */
       return 0;
+    case _SC_THREAD_ROBUST_MUTEX_NP:
+#ifdef _POSIX_THREAD_ROBUST_MUTEX_NP
+      return _POSIX_THREAD_ROBUST_MUTEX_NP;
+#else
+      return -1;
+#endif
     }
 }


Boris Hu (Hu Jiangtao)
Software Engineer@ICSL
86-021-5257-4545#1277
iNET: 8-752-1277
************************************
There are my thoughts, not my employer's.
************************************
"gpg --recv-keys --keyserver wwwkeys.pgp.net 0FD7685F"
{0FD7685F:CFD6 6F5C A2CB 7881 725B  CEA0 956F 9F14 0FD7 685F}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]