This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] Fix pthread_cond_wait bug on !i386 !x86_64
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Fri, 21 May 2004 12:05:23 -0400
- Subject: [PATCH] Fix pthread_cond_wait bug on !i386 !x86_64
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
I hope this is the only cause of the random failures of tst-cond{16,17,18}
on pthread_cond_*.c using architectures.
Certainly on 7way PPC I managed to run 71 tst-cond18 runs without a failure
(while previously it took at most 20 to fail) and so far 16 tst-cond16 runs.
2004-05-21 Jakub Jelinek <jakub@redhat.com>
* sysdeps/pthread/pthread_cond_wait.c (__pthread_cond_wait): Compare
__broadcast_seq with bc_seq after acquiring internal lock instead of
before it.
--- libc/nptl/sysdeps/pthread/pthread_cond_wait.c.jj 2004-05-19 22:58:46.000000000 +0200
+++ libc/nptl/sysdeps/pthread/pthread_cond_wait.c 2004-05-21 17:30:54.654099109 +0200
@@ -143,13 +143,13 @@ __pthread_cond_wait (cond, mutex)
/* Disable asynchronous cancellation. */
__pthread_disable_asynccancel (cbuffer.oldtype);
+ /* We are going to look at shared data again, so get the lock. */
+ lll_mutex_lock (cond->__data.__lock);
+
/* If a broadcast happened, we are done. */
if (cbuffer.bc_seq != cond->__data.__broadcast_seq)
goto bc_out;
- /* We are going to look at shared data again, so get the lock. */
- lll_mutex_lock (cond->__data.__lock);
-
/* Check whether we are eligible for wakeup. */
val = cond->__data.__wakeup_seq;
}
Jakub