summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-10-21 08:59:36 +0000
committerUlrich Drepper <drepper@redhat.com>2004-10-21 08:59:36 +0000
commitbd9d405227ba9cbf0d25fd6cf8b1a8f70bd4084a (patch)
tree92b28ae8d966858b57e80af45bc1dd625835d6ba /nptl
parent6d864d156da2e006b309eaa161437eea10fd4684 (diff)
downloadglibc-bd9d405227ba9cbf0d25fd6cf8b1a8f70bd4084a.tar.gz
glibc-bd9d405227ba9cbf0d25fd6cf8b1a8f70bd4084a.tar.xz
glibc-bd9d405227ba9cbf0d25fd6cf8b1a8f70bd4084a.zip
(__lll_mutex_timedlock_wait): If woken but cannot get the lock, make sure 2 is stored in the futex and we looked at the old value. Fix a few other problems to return the correct value.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S15
1 files changed, 11 insertions, 4 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
index 320fe18fe8..d87f089bdb 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
@@ -127,13 +127,14 @@ __lll_mutex_timedlock_wait:
 	extu.b	r3, r3
 	trapa	#0x14
 	SYSCALL_INST_PAD
-	mov	r0, r4
+	mov	r0, r5
 
-8:	
+8:
 	mov	#0, r3
 	mov	#2, r4
 	CMPXCHG (r3, @r8, r4, r2)
-	bf	7f
+	bf/s	7f
+	 mov	#0, r0
 
 6:
 	add	#8, r15
@@ -144,8 +145,14 @@ __lll_mutex_timedlock_wait:
 7:
 	/* Check whether the time expired.  */
 	mov	#-ETIMEDOUT, r1
-	cmp/eq	r4, r1
+	cmp/eq	r5, r1
 	bt	5f
+
+	/* Make sure the current holder knows we are going to sleep.  */
+	XCHG (r2, @r8, r3)
+	tst	r3, r3
+	bt/s	6b
+	 mov	#0, r0
 	bra	1b
 	 nop
 3: