about summary refs log tree commit diff
path: root/nptl/sysdeps/pthread
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-11-21 10:00:11 +0000
committerUlrich Drepper <drepper@redhat.com>2003-11-21 10:00:11 +0000
commite42a990eccb6ce79650db5fb713b94732df82f4d (patch)
tree95d395c4c8c069d3d93fe99895c0fb5415ef9d48 /nptl/sysdeps/pthread
parentbf68b2366d75a427ec74084e97e242d460196db0 (diff)
downloadglibc-e42a990eccb6ce79650db5fb713b94732df82f4d.tar.gz
glibc-e42a990eccb6ce79650db5fb713b94732df82f4d.tar.xz
glibc-e42a990eccb6ce79650db5fb713b94732df82f4d.zip
Update.
	* sysdeps/pthread/pthread_cond_wait.c (__pthread_cond_wait): Don't
	store mutex address if the current value is ~0l.
	* sysdeps/pthread/pthread_cond_timedwait.c
	(__pthread_cond_timedwait): Likewise.
	* sysdeps/pthread/pthread_cond_broadcast.c
	(__pthread_cond_broadcast): Don't use requeue for pshared
	condvars.

	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
	(__pthread_cond_wait): Don't store mutex address if the current
	value is ~0l.
	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
	(__pthread_cond_timedwait): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
	(__pthread_cond_broadcast): Don't use requeue for pshared
	condvars.

	* pthread_cond_init.c (__pthread_cond_init): Initialize __mutex
	element with ~0l for pshared condvars, with NULL otherwise.

	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
	(__pthread_cond_wait): Don't store mutex address if the current
	value is ~0l.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
	(__pthread_cond_timedwait): Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
	(__pthread_cond_broadcast): Don't use requeue for pshared
	condvars.
Diffstat (limited to 'nptl/sysdeps/pthread')
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_broadcast.c7
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_timedwait.c6
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_wait.c6
3 files changed, 13 insertions, 6 deletions
diff --git a/nptl/sysdeps/pthread/pthread_cond_broadcast.c b/nptl/sysdeps/pthread/pthread_cond_broadcast.c
index 6c3722a9cd..44c3fe6d5f 100644
--- a/nptl/sysdeps/pthread/pthread_cond_broadcast.c
+++ b/nptl/sysdeps/pthread/pthread_cond_broadcast.c
@@ -54,6 +54,10 @@ __pthread_cond_broadcast (cond)
 # 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,
@@ -61,9 +65,8 @@ __pthread_cond_broadcast (cond)
 			    0))
 	{
 	  /* The requeue functionality is not available.  */
-#ifndef __ASSUME_FUTEX_REQUEUE
+	wake_all:
 	  lll_futex_wake (futex, INT_MAX);
-#endif
 	}
 
       /* That's all.  */
diff --git a/nptl/sysdeps/pthread/pthread_cond_timedwait.c b/nptl/sysdeps/pthread/pthread_cond_timedwait.c
index 1655c70c2a..9fa2920f85 100644
--- a/nptl/sysdeps/pthread/pthread_cond_timedwait.c
+++ b/nptl/sysdeps/pthread/pthread_cond_timedwait.c
@@ -67,8 +67,10 @@ __pthread_cond_timedwait (cond, mutex, abstime)
   ++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.  */
-  cond->__data.__mutex = mutex;
+     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;
diff --git a/nptl/sysdeps/pthread/pthread_cond_wait.c b/nptl/sysdeps/pthread/pthread_cond_wait.c
index 75edf3d158..79c6d9951c 100644
--- a/nptl/sysdeps/pthread/pthread_cond_wait.c
+++ b/nptl/sysdeps/pthread/pthread_cond_wait.c
@@ -93,8 +93,10 @@ __pthread_cond_wait (cond, mutex)
   ++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.  */
-  cond->__data.__mutex = mutex;
+     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;