From: Bart Van Assche Date: Sat, 28 Jun 2008 16:55:35 +0000 (+0000) Subject: Modified code such that concurrent pthread_cond_wait() and pthread_destroy() calls... X-Git-Tag: svn/VALGRIND_3_4_0~410 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c14dd11cb3948fae354dd3edecb0204ad0fbada;p=thirdparty%2Fvalgrind.git Modified code such that concurrent pthread_cond_wait() and pthread_destroy() calls do no longer trigger an assertion failure in DRD. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8304 --- diff --git a/exp-drd/drd_cond.c b/exp-drd/drd_cond.c index e550fa61cb..219f7b3fb6 100644 --- a/exp-drd/drd_cond.c +++ b/exp-drd/drd_cond.c @@ -252,16 +252,19 @@ int cond_post_wait(const Addr cond) } p = cond_get(cond); - // To do: print a proper error message if the assert below fails. - tl_assert(p); - // To do: print a proper error message if the assert below fails. - tl_assert(p->waiter_count > 0); - tl_assert(p->mutex); - if (--p->waiter_count == 0) + if (p) { - p->mutex = 0; + if (p->waiter_count > 0) + { + --p->waiter_count; + if (p->waiter_count == 0) + { + p->mutex = 0; + } + } + return p->waiter_count; } - return p->waiter_count; + return 0; } static void cond_signal(Addr const cond)