From 4b153ac42428447a148e6da543ebe6df017078db Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 22 Sep 2011 21:08:55 -0400 Subject: fix deadlock in condition wait whenever there are multiple waiters it's amazing none of the conformance tests i've run even bothered to check whether something so basic works... --- src/thread/pthread_cond_broadcast.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/thread/pthread_cond_broadcast.c') diff --git a/src/thread/pthread_cond_broadcast.c b/src/thread/pthread_cond_broadcast.c index 30f7f6df..6002c535 100644 --- a/src/thread/pthread_cond_broadcast.c +++ b/src/thread/pthread_cond_broadcast.c @@ -2,7 +2,8 @@ int pthread_cond_broadcast(pthread_cond_t *c) { - if (a_swap(&c->_c_block, 0)) + int w = c->_c_waiters; + if (a_swap(&c->_c_block, 0) || w) __wake(&c->_c_block, -1, 0); return 0; } -- cgit v1.2.1