From c0a50d778d7666adbbe7b8c7587000f6fe513a69 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 16 Apr 2009 02:04:07 +0000 Subject: [PATCH] Merge r9564 (make pth_cvsimple more reliable) from the DARWIN branch. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9565 --- none/tests/pth_cvsimple.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) -- 2.47.3