aboutsummaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog16
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_wait.c8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S4
-rw-r--r--nptl/tst-cond22.c3
6 files changed, 28 insertions, 16 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index edc668c85d..c269f3daaa 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,11 +1,21 @@
+2006-09-08 Jakub Jelinek <jakub@redhat.com>
+
+ * tst-cond22.c: Include pthread.h instead of pthreadP.h.
+ Include stdlib.h.
+ * sysdeps/pthread/pthread_cond_wait.c (__condvar_cleanup): Only
+ increase FUTEX if increasing WAKEUP_SEQ. Fix comment typo.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
+
2006-09-08 Ulrich Drepper <drepper@redhat.com>
[BZ #3123]
* sysdeps/pthread/pthread_cond_wait.c (__condvar_cleanup): Don't
increment WAKEUP_SEQ if this would increase the value beyond TOTAL_SEQ.
- * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.c: Likewise.
- * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.c: Likewise.
- * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.c: Likewise.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
* Makefile (tests): Add tst-cond22.
* tst-cond22.c: New file.
diff --git a/nptl/sysdeps/pthread/pthread_cond_wait.c b/nptl/sysdeps/pthread/pthread_cond_wait.c
index f641a7e8b1..f5f5cec5a8 100644
--- a/nptl/sysdeps/pthread/pthread_cond_wait.c
+++ b/nptl/sysdeps/pthread/pthread_cond_wait.c
@@ -51,13 +51,15 @@ __condvar_cleanup (void *arg)
{
/* This thread is not waiting anymore. Adjust the sequence counters
appropriately. We do not increment WAKEUP_SEQ if this would
- bump it over the value of TOTAL_SEQ> This can happen if a thread
+ bump it over the value of TOTAL_SEQ. This can happen if a thread
was woken and then canceled. */
if (cbuffer->cond->__data.__wakeup_seq
< cbuffer->cond->__data.__total_seq)
- ++cbuffer->cond->__data.__wakeup_seq;
+ {
+ ++cbuffer->cond->__data.__wakeup_seq;
+ ++cbuffer->cond->__data.__futex;
+ }
++cbuffer->cond->__data.__woken_seq;
- ++cbuffer->cond->__data.__futex;
}
cbuffer->cond->__data.__nwaiters -= 1 << COND_CLOCK_BITS;
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 692e0dd670..f481a8e43c 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
@@ -406,7 +406,7 @@ __condvar_tw_cleanup:
cmpl 20(%esp), %eax
jne 3f
- /* We increment the woken_seq counter only if it is lower than
+ /* We increment the wakeup_seq counter only if it is lower than
total_seq. If this is not the case the thread was woken and
then canceled. In this case we ignore the signal. */
movl total_seq(%ebx), %eax
@@ -419,10 +419,9 @@ __condvar_tw_cleanup:
6: addl $1, wakeup_seq(%ebx)
adcl $0, wakeup_seq+4(%ebx)
+ addl $1, cond_futex(%ebx)
-7: addl $1, cond_futex(%ebx)
-
- addl $1, woken_seq(%ebx)
+7: addl $1, woken_seq(%ebx)
adcl $0, woken_seq+4(%ebx)
3: subl $(1 << clock_bits), cond_nwaiters(%ebx)
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 7f93a85732..f16c7d9198 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
@@ -297,7 +297,7 @@ __condvar_w_cleanup:
cmpl 12(%esp), %eax
jne 3f
- /* We increment the woken_seq counter only if it is lower than
+ /* We increment the wakeup_seq counter only if it is lower than
total_seq. If this is not the case the thread was woken and
then canceled. In this case we ignore the signal. */
movl total_seq(%ebx), %eax
@@ -310,9 +310,9 @@ __condvar_w_cleanup:
6: addl $1, wakeup_seq(%ebx)
adcl $0, wakeup_seq+4(%ebx)
+ addl $1, cond_futex(%ebx)
-7: addl $1, cond_futex(%ebx)
- addl $1, woken_seq(%ebx)
+7: addl $1, woken_seq(%ebx)
adcl $0, woken_seq+4(%ebx)
3: subl $(1 << clock_bits), cond_nwaiters(%ebx)
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
index 6b8091b3ee..969e80da2a 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
@@ -67,15 +67,15 @@ __condvar_cleanup:
cmpl 4(%r8), %edx
jne 3f
- /* We increment the woken_seq counter only if it is lower than
+ /* We increment the wakeup_seq counter only if it is lower than
total_seq. If this is not the case the thread was woken and
then canceled. In this case we ignore the signal. */
movq total_seq(%rdi), %rax
cmpq wakeup_seq(%rdi), %rax
jbe 6f
incq wakeup_seq(%rdi)
-6: incq woken_seq(%rdi)
incl cond_futex(%rdi)
+6: incq woken_seq(%rdi)
3: subl $(1 << clock_bits), cond_nwaiters(%rdi)
diff --git a/nptl/tst-cond22.c b/nptl/tst-cond22.c
index 0e829ff2e9..1094c09068 100644
--- a/nptl/tst-cond22.c
+++ b/nptl/tst-cond22.c
@@ -1,5 +1,6 @@
-#include <pthreadP.h>
+#include <pthread.h>
#include <stdio.h>
+#include <stdlib.h>
static pthread_barrier_t b;