aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/x86_64
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-09-08 17:41:56 +0000
committerUlrich Drepper <drepper@redhat.com>2005-09-08 17:41:56 +0000
commita3615024b9b204a124429a73d82827b189faaada (patch)
tree25d30717a99ee9950d0c6207ffc599fe4ad3eb49 /nptl/sysdeps/unix/sysv/linux/x86_64
parentb9b8cf036684d69a1bac70cb604ad7dd4c31b8c4 (diff)
downloadglibc-a3615024b9b204a124429a73d82827b189faaada.tar
glibc-a3615024b9b204a124429a73d82827b189faaada.tar.gz
glibc-a3615024b9b204a124429a73d82827b189faaada.tar.bz2
glibc-a3615024b9b204a124429a73d82827b189faaada.zip
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (FUTEX_WAKE_OP,
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define. (lll_futex_wake_unlock): Define. * sysdeps/unix/sysv/linux/alpha/lowlevellock.h (FUTEX_WAKE_OP, FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define. (lll_futex_wake_unlock): Define. * sysdeps/unix/sysv/linux/ia64/lowlevellock.h (FUTEX_WAKE_OP, FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define. (lll_futex_wake_unlock): Define. * sysdeps/unix/sysv/linux/s390/lowlevellock.h (FUTEX_WAKE_OP, FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define. (lll_futex_wake_unlock): Define. * sysdeps/unix/sysv/linux/sparc/lowlevellock.h (FUTEX_WAKE_OP, FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define. (lll_futex_wake_unlock): Define. * sysdeps/pthread/pthread_cond_signal.c (__pthread_cond_signal): Use lll_futex_wake_unlock. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S (FUTEX_WAKE_OP, FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define. (__pthread_cond_signal): Use FUTEX_WAKE_OP. * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S (FUTEX_WAKE_OP, FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define. (__pthread_cond_signal): Use FUTEX_WAKE_OP.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/x86_64')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S27
1 files changed, 25 insertions, 2 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
index de9e109f45..3dbb9e81e3 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
@@ -31,7 +31,9 @@
#define SYS_futex 202
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-#define FUTEX_REQUEUE 3
+#define FUTEX_WAKE_OP 5
+
+#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE ((4 << 24) | 1)
#define EINVAL 22
@@ -66,9 +68,30 @@ __pthread_cond_signal:
addl $1, (%rdi)
/* Wake up one thread. */
- movl $FUTEX_WAKE, %esi
+ movl $FUTEX_WAKE_OP, %esi
movl $SYS_futex, %eax
movl $1, %edx
+ movl $1, %r10d
+#if cond_lock != 0
+ addq $cond_lock, %r8
+#endif
+ movl $FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, %r9d
+ syscall
+#if cond_lock != 0
+ subq $cond_lock, %r8
+#endif
+ /* For any kind of error, we try again with WAKE.
+ The general test also covers running on old kernels. */
+ cmpq $-4095, %rax
+ jae 7f
+
+ xorl %eax, %eax
+ retq
+
+7: movl $FUTEX_WAKE, %esi
+ movl $SYS_futex, %eax
+ /* %rdx should be 1 already from $FUTEX_WAKE_OP syscall.
+ movl $1, %edx */
syscall
/* Unlock. */