[PATCH] Fix pthread_cond_wait bug on !i386 !x86_64
Jakub Jelinek
jakub@redhat.com
Fri May 21 16:36:00 GMT 2004
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
More information about the Libc-alpha
mailing list