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>2004-10-01 10:33:03 +0000
committerUlrich Drepper <drepper@redhat.com>2004-10-01 10:33:03 +0000
commitc1b48791e0240ff83a72e54eaeccc04d1077ecaf (patch)
treefa2f287092136563ad39e658463da8ee5b37ce9c /nptl/sysdeps/unix/sysv/linux/i386
parent0da4ee554369b536c554cbc2d50f1abf5e42bdf5 (diff)
downloadglibc-c1b48791e0240ff83a72e54eaeccc04d1077ecaf.tar.gz
glibc-c1b48791e0240ff83a72e54eaeccc04d1077ecaf.tar.xz
glibc-c1b48791e0240ff83a72e54eaeccc04d1077ecaf.zip
Update.
2004-10-01  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
	(__lll_mutex_timedlock_wait): I woken but cannot get the lock,
	make sure 2 is stored in the futex and we looked at the old value.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
	(__lll_mutex_timedlock_wait): Likewise.  Fix a few other problems
	which might very well made the code not working at all before.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/i386')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S9
1 files changed, 7 insertions, 2 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
index 96ea35caac..dc65b709a1 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
@@ -132,9 +132,8 @@ __lll_mutex_timedlock_wait:
 	ENTER_KERNEL
 	movl	%eax, %ecx
 
-8:
+8:				/* NB: %edx == 2 */
 	xorl	%eax, %eax
-	movl	$2, %edx
 	LOCK
 	cmpxchgl %edx, (%ebx)
 
@@ -150,6 +149,12 @@ __lll_mutex_timedlock_wait:
 	/* Check whether the time expired.  */
 7:	cmpl	$-ETIMEDOUT, %ecx
 	je	5f
+
+	/* Make sure the current holder knows we are going to sleep.  */
+	movl	%edx, %eax
+	xchgl	%eax, (%ebx)
+	testl	%eax, %eax
+	jz	6b
 	jmp	1b
 
 3:	movl	$EINVAL, %eax