From: Bart Van Assche Date: Sun, 23 Oct 2011 13:28:20 +0000 (+0000) Subject: helgrind/tests/tc08_hbl2: Avoid busy-waiting X-Git-Tag: svn/VALGRIND_3_7_0~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c9b048a6dd5ab626fe3420af86c759f84389269;p=thirdparty%2Fvalgrind.git helgrind/tests/tc08_hbl2: Avoid busy-waiting git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12216 --- diff --git a/helgrind/tests/tc08_hbl2.c b/helgrind/tests/tc08_hbl2.c index 9c05e38d07..8cc682b74e 100644 --- a/helgrind/tests/tc08_hbl2.c +++ b/helgrind/tests/tc08_hbl2.c @@ -102,7 +102,8 @@ void* child_fn ( void* arg ) { int q = 0; int oldx = 0; - int ctr = 0; + struct timespec ts = { 0, 1000 * 1000 }; + while (1) { q = (x >= LIMIT); if (x != oldx) { @@ -111,10 +112,7 @@ void* child_fn ( void* arg ) fflush(stdout); } if (q) break; - /* Make sure the parent doesn't starve. Seems to be a problem - on very slow machines. */ - ctr++; - if (ctr == 2000000) sleep(1); + nanosleep(&ts, 0); } return NULL; }