aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nptl/ChangeLog10
-rw-r--r--nptl/DESIGN-condvar.txt2
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_timedwait.c2
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_wait.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S12
6 files changed, 22 insertions, 16 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 1b153bc..146c5c3 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,13 @@
+2004-03-01 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+ (__pthread_cond_timedwait): Optimize wakeup test.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+ (__pthread_cond_wait): Likewise.
+ * sysdeps/pthread/pthread_cond_wait.c (__pthread_cond_wait): Likewise.
+ * sysdeps/pthread/pthread_cond_timedwait.c (__pthread_cond_timedwait):
+ Likewise.
+
2004-02-29 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
diff --git a/nptl/DESIGN-condvar.txt b/nptl/DESIGN-condvar.txt
index 4a8212b..cb0f59c 100644
--- a/nptl/DESIGN-condvar.txt
+++ b/nptl/DESIGN-condvar.txt
@@ -65,7 +65,7 @@ cond_timedwait(cv, mutex, timeout):
val = cv->wakeup_seq;
- if (val > seq && cv->woken_seq < val) {
+ if (val != seq && cv->woken_seq != val) {
ret = 0;
break;
}
diff --git a/nptl/sysdeps/pthread/pthread_cond_timedwait.c b/nptl/sysdeps/pthread/pthread_cond_timedwait.c
index 80b8310..a03f51e 100644
--- a/nptl/sysdeps/pthread/pthread_cond_timedwait.c
+++ b/nptl/sysdeps/pthread/pthread_cond_timedwait.c
@@ -159,7 +159,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
/* Check whether we are eligible for wakeup. */
val = cond->__data.__wakeup_seq;
- if (val > seq && cond->__data.__woken_seq < val)
+ if (val != seq && cond->__data.__woken_seq != val)
break;
/* Not woken yet. Maybe the time expired? */
diff --git a/nptl/sysdeps/pthread/pthread_cond_wait.c b/nptl/sysdeps/pthread/pthread_cond_wait.c
index 4435ef8..01415bf 100644
--- a/nptl/sysdeps/pthread/pthread_cond_wait.c
+++ b/nptl/sysdeps/pthread/pthread_cond_wait.c
@@ -143,7 +143,7 @@ __pthread_cond_wait (cond, mutex)
/* Check whether we are eligible for wakeup. */
val = cond->__data.__wakeup_seq;
}
- while (! (val > seq && cond->__data.__woken_seq < val));
+ while (val == seq || cond->__data.__woken_seq == val);
/* Another thread woken up. */
++cond->__data.__woken_seq;
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 8e6e4bf..b1c32ea 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
@@ -190,16 +190,14 @@ __pthread_cond_timedwait:
movl wakeup_seq+4(%ebx), %edx
cmpl 16(%esp), %edx
- ja 7f
- jb 15f
+ jne 7f
cmpl 12(%esp), %edi
- jbe 15f
+ je 15f
7: cmpl %ecx, %edx
- ja 9f
- jb 15f
+ jne 9f
cmp %eax, %edi
- ja 9f
+ jne 9f
15: cmpl $-ETIMEDOUT, %esi
jne 8b
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
index b38fd6b..38cb36a 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.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.
@@ -133,16 +133,14 @@ __pthread_cond_wait:
movl wakeup_seq+4(%ebx), %edx
cmpl 8(%esp), %edx
- ja 7f
- jb 8b
+ jne 7f
cmpl 4(%esp), %edi
- jbe 8b
+ je 8b
7: cmpl %ecx, %edx
- ja 9f
- jb 8b
+ jne 9f
cmp %eax, %edi
- jna 8b
+ je 8b
9: addl $1, woken_seq(%ebx)
adcl $0, woken_seq+4(%ebx)