about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-05-26 02:47:39 +0000
committerUlrich Drepper <drepper@redhat.com>2003-05-26 02:47:39 +0000
commit69431c9a21f7393f34330a27df1630520930789e (patch)
tree1fbd3f1520502c833e676afa3fb5410f92654f85 /nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
parent6a998b09ec734d8dd40e690244122a43bf9d7a16 (diff)
downloadglibc-69431c9a21f7393f34330a27df1630520930789e.tar.gz
glibc-69431c9a21f7393f34330a27df1630520930789e.tar.xz
glibc-69431c9a21f7393f34330a27df1630520930789e.zip
Update.
2003-05-25  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/kernel-features.h: Define
	__ASSUME_FUTEX_REQUEUE for >= 2.5.70.

	* math/test-fenv.c (feexcp_nomask_test): Fix comment.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S27
1 files changed, 25 insertions, 2 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 cc12f5407c..66edb9ac85 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
@@ -20,6 +20,7 @@
 #include <sysdep.h>
 #include <shlib-compat.h>
 #include <lowlevelcond.h>
+#include <kernel-features.h>
 
 #ifdef UP
 # define LOCK
@@ -30,6 +31,9 @@
 #define SYS_futex		202
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
+#define FUTEX_REQUEUE		3
+
+#define EINVAL			22
 
 
 	.text
@@ -60,17 +64,27 @@ __pthread_cond_broadcast:
 	   woken up.  */
 	movq	%rcx, (%rdi)
 
+	/* Get the address of the mutex used.  */
+	movq	dep_mutex-wakeup_seq(%rdi), %r8
+
 	/* Unlock.  */
 	LOCK
 	decl	cond_lock-wakeup_seq(%rdi)
 	jne	7f
 
 	/* Wake up all threads.  */
-8:	movq	$FUTEX_WAKE, %rsi
+8:	movq	$FUTEX_REQUEUE, %rsi
 	movq	$SYS_futex, %rax
-	movl	$0x7fffffff, %edx
+	movl	$1, %edx
+	movq	$0x7fffffff, %r10
 	syscall
 
+#ifndef __ASSUME_FUTEX_REQUEUE
+	cmpq	$-EINVAL, %eax
+	je	9f
+10:
+#endif
+
 	xorl	%eax, %eax
 	retq
 
@@ -104,6 +118,15 @@ __pthread_cond_broadcast:
 	callq	__lll_mutex_unlock_wake
 	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)