From: Nicholas Nethercote Date: Thu, 16 Apr 2009 02:04:07 +0000 (+0000) Subject: Merge r9564 (make pth_cvsimple more reliable) from the DARWIN branch. X-Git-Tag: svn/VALGRIND_3_5_0~809 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c0a50d778d7666adbbe7b8c7587000f6fe513a69;p=thirdparty%2Fvalgrind.git Merge r9564 (make pth_cvsimple more reliable) from the DARWIN branch. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9565 --- diff --git a/none/tests/pth_cvsimple.c b/none/tests/pth_cvsimple.c index f525e3623b..b260cfb02a 100644 --- a/none/tests/pth_cvsimple.c +++ b/none/tests/pth_cvsimple.c @@ -12,7 +12,7 @@ * Demonstrates pthread condvars. * */ - +#include #include #include @@ -65,6 +65,7 @@ main(void) pthread_t threads[3]; pthread_create(&threads[0], NULL, watch_count, NULL); + sleep(1); pthread_create(&threads[1], NULL, inc_count, NULL); pthread_create(&threads[2], NULL, inc_count, NULL); @@ -77,6 +78,7 @@ main(void) // pthread_cond_wait() is never called. Or, we could get a spurious // wake-up in watch_count(). Nonetheless, it's very likely that things // will work out as expected, since we're starting watch_count() first. + // (Also since the sleep() call was added after watch_count()!) if (condvar_was_hit == 1) printf("condvar was hit!\n"); else if (condvar_was_hit > 1)