diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-09-22 21:08:55 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-09-22 21:08:55 -0400 |
commit | 4b153ac42428447a148e6da543ebe6df017078db (patch) | |
tree | d9a5b8035f98b8cec47fc6044e38305ea5cdb91a /src/thread/pthread_cond_signal.c | |
parent | fix x86_64 user.h (previously was just a copy of i386) (diff) | |
download | grovel-4b153ac42428447a148e6da543ebe6df017078db.tar.gz grovel-4b153ac42428447a148e6da543ebe6df017078db.tar.xz |
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...
Diffstat (limited to 'src/thread/pthread_cond_signal.c')
-rw-r--r-- | src/thread/pthread_cond_signal.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/thread/pthread_cond_signal.c b/src/thread/pthread_cond_signal.c index a0211287..e8ed71cc 100644 --- a/src/thread/pthread_cond_signal.c +++ b/src/thread/pthread_cond_signal.c @@ -2,7 +2,8 @@ int pthread_cond_signal(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; } |