From: Bart Van Assche Date: Mon, 30 Jun 2008 11:13:35 +0000 (+0000) Subject: Fixed race condition which could make the test program hang (signal could be sent... X-Git-Tag: svn/VALGRIND_3_4_0~404 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=974f38358d0116b8746c43a1d81b31e29ea9c120;p=thirdparty%2Fvalgrind.git Fixed race condition which could make the test program hang (signal could be sent before pthread_cond_wait() started). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8319 --- diff --git a/exp-drd/tests/pth_inconsistent_cond_wait.c b/exp-drd/tests/pth_inconsistent_cond_wait.c index ad5df4e21b..b863357fd5 100644 --- a/exp-drd/tests/pth_inconsistent_cond_wait.c +++ b/exp-drd/tests/pth_inconsistent_cond_wait.c @@ -44,6 +44,10 @@ int main(int argc, char** argv) pthread_create(&tid1, 0, &thread1, 0); pthread_create(&tid2, 0, &thread2, 0); sem_wait(&s_sem); + pthread_mutex_lock(&s_mutex1); + pthread_mutex_lock(&s_mutex2); + pthread_mutex_unlock(&s_mutex2); + pthread_mutex_unlock(&s_mutex1); pthread_cond_signal(&s_cond); pthread_cond_signal(&s_cond); pthread_join(tid1, 0);