about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/i386
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/unix/sysv/linux/i386
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/unix/sysv/linux/i386')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S6
3 files changed, 14 insertions, 9 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
index cdcf6d2914..8d09e22afd 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
@@ -83,8 +83,12 @@ __pthread_cond_broadcast:
 	subl	$1, cond_lock-wakeup_seq(%ebx)
 	jne	7f
 
+	/* Don't use requeue for pshared condvars.  */
+8:	cmpl	$-1, %edi
+	je	9f
+
 	/* Wake up all threads.  */
-8:	movl	$FUTEX_REQUEUE, %ecx
+	movl	$FUTEX_REQUEUE, %ecx
 	movl	$SYS_futex, %eax
 	movl	$0x7fffffff, %esi
 	movl	$1, %edx
@@ -97,10 +101,9 @@ __pthread_cond_broadcast:
 #ifndef __ASSUME_FUTEX_REQUEUE
 	cmpl	$-EINVAL, %eax
 	je	9f
-10:
 #endif
 
-	xorl	%eax, %eax
+10:	xorl	%eax, %eax
 	popl	%edi
 	popl	%esi
 	popl	%ebx
@@ -138,14 +141,12 @@ __pthread_cond_broadcast:
 	call	__lll_mutex_unlock_wake
 	jmp	8b
 
-#ifndef __ASSUME_FUTEX_REQUEUE
 9:	/* The futex requeue functionality is not available.  */
 	movl	$0x7fffffff, %edx
 	movl	$FUTEX_WAKE, %ecx
 	movl	$SYS_futex, %eax
 	ENTER_KERNEL
 	jmp	10b
-#endif
 	.size	__pthread_cond_broadcast, .-__pthread_cond_broadcast
 versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
 		  GLIBC_2_3_2)
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
index ca5c1423c0..06ad11c11b 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
@@ -68,11 +68,13 @@ __pthread_cond_timedwait:
 
 	/* Store the reference to the mutex.  If there is already a
 	   different value in there this is a bad user bug.  */
-2:	movl	24(%esp), %eax
+2:	cmpl	$-1, dep_mutex(%ebx)
+	movl	24(%esp), %eax
+	je	17f
 	movl	%eax, dep_mutex(%ebx)
 
 	/* Unlock the mutex.  */
-	xorl	%edx, %edx
+17:	xorl	%edx, %edx
 	call	__pthread_mutex_unlock_usercnt
 
 	testl	%eax, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
index ff3a1ccef3..b38fd6bf3b 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
@@ -65,11 +65,13 @@ __pthread_cond_wait:
 
 	/* Store the reference to the mutex.  If there is already a
 	   different value in there this is a bad user bug.  */
-2:	movl	20(%esp), %eax
+2:	cmpl	$-1, dep_mutex(%ebx)
+	movl	20(%esp), %eax
+	je	15f
 	movl	%eax, dep_mutex(%ebx)
 
 	/* Unlock the mutex.  */
-	xorl	%edx, %edx
+15:	xorl	%edx, %edx
 	call	__pthread_mutex_unlock_usercnt
 
 	testl	%eax, %eax