about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-02-13 08:04:27 +0000
committerUlrich Drepper <drepper@redhat.com>2004-02-13 08:04:27 +0000
commit3730d95c778f794fff48574c95d6658d6d5224ed (patch)
treef8adba96ea8c06f8ed8ad97e137ef2ef26189063 /nptl
parent2a1ece14a516ff546f38f5e2a68a23f0cd8a6701 (diff)
downloadglibc-3730d95c778f794fff48574c95d6658d6d5224ed.tar.gz
glibc-3730d95c778f794fff48574c95d6658d6d5224ed.tar.xz
glibc-3730d95c778f794fff48574c95d6658d6d5224ed.zip
Update.
2004-02-13  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
	(__pthread_cond_timedwait): Get internal lock in case timeout has
	passed before the futex syscall.
	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S26
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S28
3 files changed, 57 insertions, 4 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index ef9aa2d36b..351ff05041 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,10 @@
+2004-02-13  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+	(__pthread_cond_timedwait): Get internal lock in case timeout has
+	passed before the futex syscall.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
+
 2004-01-20  Ulrich Drepper  <drepper@redhat.com>
 
 	* allocatestack.c: Pretty printing.
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 06ad11c11b..1783095ff8 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
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -202,8 +202,20 @@ __pthread_cond_timedwait:
 
 15:	cmpl	$-ETIMEDOUT, %esi
 	jne	8b
+	jmp	24f
 
-13:	addl	$1, wakeup_seq(%ebx)
+	/* Lock.  */
+13:	movl	$1, %edx
+	xorl	%eax, %eax
+	LOCK
+#if cond_lock == 0
+	cmpxchgl %edx, (%ebx)
+#else
+	cmpxchgl %edx, cond_lock(%ebx)
+#endif
+	jnz	23f
+
+24:	addl	$1, wakeup_seq(%ebx)
 	adcl	$0, wakeup_seq+4(%ebx)
 	movl	$ETIMEDOUT, %esi
 	jmp	14f
@@ -335,6 +347,16 @@ __pthread_cond_timedwait:
 	js	13b
 	jmp	21b
 #endif
+
+	/* Locking after time elapsed failed.  */
+23:
+#if cond_lock == 0
+	movl	%ebx, %ecx
+#else
+	leal	cond_lock(%ebx), %ecx
+#endif
+	call	__lll_mutex_lock_wait
+	jmp	24b
 	.size	__pthread_cond_timedwait, .-__pthread_cond_timedwait
 versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
 		  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 e001441490..cd5d64791f 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
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -212,8 +212,21 @@ __pthread_cond_timedwait:
 
 15:	cmpq	$-ETIMEDOUT, %r14
 	jne	8b
+	jmp	24f
 
-13:	incq	wakeup_seq(%rdi)
+	/* Lock.  */
+13:	movq	8(%rsp), %rdi
+	movl	$1, %esi
+	xorl	%eax, %eax
+	LOCK
+#if cond_lock == 0
+	cmpxchgl %esi, (%rdi)
+#else
+	cmpxchgl %esi, cond_lock(%rdi)
+#endif
+	jne	23f
+
+24:	incq	wakeup_seq(%rdi)
 	movq	$ETIMEDOUT, %r14
 	jmp	14f
 
@@ -327,6 +340,17 @@ __pthread_cond_timedwait:
 	js	13b
 	jmp	21b
 #endif
+
+	/* Locking after time elapsed failed.  */
+23:
+#if cond_lock != 0
+	addq	$cond_lock, %rdi
+#endif
+	callq	__lll_mutex_lock_wait
+#if cond_lock != 0
+	subq	$cond_lock, %rdi
+#endif
+	jmp	24b
 .LENDCODE:
 	.size	__pthread_cond_timedwait, .-__pthread_cond_timedwait
 versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,