From: Bart Van Assche Date: Sat, 30 Jul 2011 16:50:33 +0000 (+0000) Subject: Yet another thread test scheduler sensitivity fix X-Git-Tag: svn/VALGRIND_3_7_0~284 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a99feb576391d260959882c74a5c4710581e5056;p=thirdparty%2Fvalgrind.git Yet another thread test scheduler sensitivity fix git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11953 --- diff --git a/drd/tests/annotate_hb_race.c b/drd/tests/annotate_hb_race.c index e14d119825..14970f1825 100644 --- a/drd/tests/annotate_hb_race.c +++ b/drd/tests/annotate_hb_race.c @@ -27,16 +27,20 @@ static void* thread_func(void* arg) int main(int argc, char** argv) { + const struct timespec delay = { 0, 100 * 1000 * 1000 }; pthread_t tid[2]; int result[2]; U_ANNOTATE_HAPPENS_BEFORE(&s_i); pthread_create(&tid[0], 0, thread_func, &result[0]); - //pthread_create(&tid[1], 0, thread_func, &result[1]); + pthread_create(&tid[1], 0, thread_func, &result[1]); + + nanosleep(&delay, 0); + s_i = 1; pthread_join(tid[0], NULL); - //pthread_join(tid[1], NULL); + pthread_join(tid[1], NULL); fprintf(stderr, "Done.\n");