about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nptl/Banner2
-rw-r--r--nptl/ChangeLog4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h28
-rw-r--r--nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h12
5 files changed, 44 insertions, 3 deletions
diff --git a/nptl/Banner b/nptl/Banner
index 415c8db49d..32b4eeec75 100644
--- a/nptl/Banner
+++ b/nptl/Banner
@@ -1 +1 @@
-NPTL 0.41 by Ulrich Drepper
+NPTL 0.42 by Ulrich Drepper
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 5d22f7f525..5b7d306869 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,9 @@
 2003-05-29  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/unix/sysv/linux/s390/lowlevellock.h
+	(__lll_mutex_unlock_force): New function
+	(lll_mutex_unlock_force): Use __lll_mutex_unlock_force.
+
 	* sysdeps/unix/sysv/linux/ia64/lowlevellock.h
 	(__lll_mutex_unlock_force): New function.
 	(lll_mutex_unlock_force): Use __lll_mutex_unlock_force.
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
index 9569ba5534..588f2a21b9 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
@@ -93,6 +93,7 @@ typedef union
     unsigned long long int __total_seq;
     unsigned long long int __wakeup_seq;
     unsigned long long int __woken_seq;
+    void *__mutex;
   } __data;
   char __size[__SIZEOF_PTHREAD_COND_T];
   long long int __align;
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
index 621fdcee88..877483b22c 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
@@ -29,6 +29,7 @@
 #define __NR_futex		221
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
+#define FUTEX_REQUEUE		3
 
 /* Initializer for compatibility lock.	*/
 #define LLL_MUTEX_LOCK_INITIALIZER (0)
@@ -63,6 +64,17 @@
     INTERNAL_SYSCALL_ERROR_P (__ret, __err)? -__ret: 0;			      \
   })
 
+#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex) \
+  ({									      \
+    INTERNAL_SYSCALL_DECL (__err);					      \
+    long int __ret;							      \
+									      \
+    __ret = INTERNAL_SYSCALL (futex, __err, 5,				      \
+			      (futexp), FUTEX_REQUEUE, (nr_wake), (nr_move),  \
+			      (mutex));					      \
+    INTERNAL_SYSCALL_ERROR_P (__ret, __err)? -__ret: 0;			      \
+  })
+
 #ifdef UP
 # define __lll_acq_instr	""
 # define __lll_rel_instr	""
@@ -100,6 +112,15 @@ extern void __lll_lock_wait (int *futex, int val) attribute_hidden;
       __lll_lock_wait (__futex, __val);					      \
   })
 
+#define lll_mutex_cond_lock(lock) \
+  (void) ({								      \
+    int *__futex = &(lock);						      \
+    int __val = atomic_exchange_and_add (__futex, 2);			      \
+    __asm __volatile (__lll_acq_instr ::: "memory");			      \
+    if (__builtin_expect (__val != 0, 0))				      \
+      __lll_lock_wait (__futex, __val);					      \
+  })
+
 extern int __lll_timedlock_wait
 	(int *futex, int val, const struct timespec *) attribute_hidden;
 
@@ -120,6 +141,13 @@ extern int __lll_timedlock_wait
       lll_futex_wake (__futex, 1);					      \
   }))
 
+#define lll_mutex_unlock_force(lock) \
+  ((void) ({								      \
+    int *__futex = &(lock);						      \
+    *__futex = 0;							      \
+    lll_futex_wake (__futex, 1);					      \
+  }))
+
 #define lll_mutex_islocked(futex) \
   (futex != 0)
 
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
index 62a06b5c5e..4d95319f1c 100644
--- a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
@@ -170,7 +170,7 @@ __attribute__ ((always_inline))
 __lll_mutex_unlock (int *futex)
 {
   int oldval;
-  int newval;
+  int newval = 0;
 
   lll_compare_and_swap (futex, oldval, newval, "slr %2,%2");
   if (oldval > 1)
@@ -179,8 +179,16 @@ __lll_mutex_unlock (int *futex)
 #define lll_mutex_unlock(futex) \
   __lll_mutex_unlock(&(futex))
 
+
+static inline void
+__attribute__ ((always_inline))
+__lll_mutex_unlock_force (int *futex)
+{
+  *futex = 0;
+  lll_futex_wake (futex, 1);
+}
 #define lll_mutex_unlock_force(futex) \
-  lll_futex_wake (&(futex), 1)
+  __lll_mutex_unlock_force(&(futex))
 
 #define lll_mutex_islocked(futex) \
   (futex != 0)