about summary refs log tree commit diff
path: root/nptl/sysdeps/pthread
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-09-08 10:41:17 +0000
committerUlrich Drepper <drepper@redhat.com>2006-09-08 10:41:17 +0000
commit346e6ad4016f3a19f71ccd0edd8a2682746d6fe7 (patch)
treef96d1336d032a8b0d2438378e4fe621b7a5590f9 /nptl/sysdeps/pthread
parent469615bdd422cec2d89a09c765a8e965faa29722 (diff)
downloadglibc-346e6ad4016f3a19f71ccd0edd8a2682746d6fe7.tar.gz
glibc-346e6ad4016f3a19f71ccd0edd8a2682746d6fe7.tar.xz
glibc-346e6ad4016f3a19f71ccd0edd8a2682746d6fe7.zip
[BZ #3123]
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.
	* Makefile (tests): Add tst-cond22.
	* tst-cond22.c: New file.
Diffstat (limited to 'nptl/sysdeps/pthread')
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_wait.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/nptl/sysdeps/pthread/pthread_cond_wait.c b/nptl/sysdeps/pthread/pthread_cond_wait.c
index 86669458a0..f641a7e8b1 100644
--- a/nptl/sysdeps/pthread/pthread_cond_wait.c
+++ b/nptl/sysdeps/pthread/pthread_cond_wait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -50,8 +50,12 @@ __condvar_cleanup (void *arg)
   if (cbuffer->bc_seq == cbuffer->cond->__data.__broadcast_seq)
     {
       /* This thread is not waiting anymore.  Adjust the sequence counters
-	 appropriately.  */
-      ++cbuffer->cond->__data.__wakeup_seq;
+	 appropriately.  We do not increment WAKEUP_SEQ if this would
+	 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.__woken_seq;
       ++cbuffer->cond->__data.__futex;
     }