From 346e6ad4016f3a19f71ccd0edd8a2682746d6fe7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 8 Sep 2006 10:41:17 +0000 Subject: [BZ #3123] 2006-09-08 Ulrich Drepper [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. * Makefile (tests): Add tst-cond22. * tst-cond22.c: New file. --- nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'nptl/sysdeps/unix/sysv/linux/x86_64') 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 b837d466b1..6b8091b3ee 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 @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -67,8 +67,14 @@ __condvar_cleanup: cmpl 4(%r8), %edx jne 3f + /* We increment the woken_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) - incq woken_seq(%rdi) +6: incq woken_seq(%rdi) incl cond_futex(%rdi) 3: subl $(1 << clock_bits), cond_nwaiters(%rdi) -- cgit v1.2.3-70-g09d2