about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/x86_64
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/x86_64
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/x86_64')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S7
3 files changed, 14 insertions, 8 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
index e6b2bbf19c..8e26681b3b 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
@@ -72,8 +72,11 @@ __pthread_cond_broadcast:
 	decl	cond_lock-wakeup_seq(%rdi)
 	jne	7f
 
+8:	cmpq	$-1, %r8
+	je	9f
+
 	/* Wake up all threads.  */
-8:	movq	$FUTEX_REQUEUE, %rsi
+	movq	$FUTEX_REQUEUE, %rsi
 	movq	$SYS_futex, %rax
 	movl	$1, %edx
 	movq	$0x7fffffff, %r10
@@ -82,10 +85,9 @@ __pthread_cond_broadcast:
 #ifndef __ASSUME_FUTEX_REQUEUE
 	cmpq	$-EINVAL, %rax
 	je	9f
-10:
 #endif
 
-	xorl	%eax, %eax
+10:	xorl	%eax, %eax
 	retq
 
 	.align	16
@@ -119,14 +121,12 @@ __pthread_cond_broadcast:
 	subq	$cond_lock-wakeup_seq, %rdi
 	jmp	8b
 
-#ifndef __ASSUME_FUTEX_REQUEUE
 9:	/* The futex requeue functionality is not available.  */
 	movq	$0x7fffffff, %rdx
 	movq	$FUTEX_WAKE, %rsi
 	movq	$SYS_futex, %rax
 	syscall
 	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/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
index c0c8f55cfb..e001441490 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
@@ -71,15 +71,18 @@ __pthread_cond_timedwait:
 	            +--------------------------+
 	*/
 
+	cmpq	$-1, dep_mutex(%rdi)
+
 	/* Prepare structure passed to cancellation handler.  */
 	movq	%rdi, 8(%rsp)
 	movq	%rsi, 16(%rsp)
 	movq	%rdx, %r13
 
+	je	22f
 	movq	%rsi, dep_mutex(%rdi)
 
 	/* Get internal lock.  */
-	movl	$1, %esi
+22:	movl	$1, %esi
 	xorl	%eax, %eax
 	LOCK
 #if cond_lock == 0
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
index d8681ebe6b..e572874d7a 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
@@ -117,14 +117,17 @@ __pthread_cond_wait:
 	            +--------------------------+
 	*/
 
-	/* Prepare structure passed to cancellation handler.  */
+	cmpq	$-1, dep_mutex(%rdi)
+
+		/* Prepare structure passed to cancellation handler.  */
 	movq	%rdi, 8(%rsp)
 	movq	%rsi, 16(%rsp)
 
+	je	15f
 	movq	%rsi, dep_mutex(%rdi)
 
 	/* Get internal lock.  */
-	movl	$1, %esi
+15:	movl	$1, %esi
 	xorl	%eax, %eax
 	LOCK
 #if cond_lock == 0