helgrind/tests/tc08_hbl2: Avoid busy-waiting
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12216 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/helgrind/tests/tc08_hbl2.c b/helgrind/tests/tc08_hbl2.c
index 9c05e38..8cc682b 100644
--- a/helgrind/tests/tc08_hbl2.c
+++ b/helgrind/tests/tc08_hbl2.c
@@ -102,7 +102,8 @@
{
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 @@
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;
}