|
From: <sv...@va...> - 2011-10-23 13:33:04
|
Author: bart
Date: 2011-10-23 14:28:20 +0100 (Sun, 23 Oct 2011)
New Revision: 12216
Log:
helgrind/tests/tc08_hbl2: Avoid busy-waiting
Modified:
trunk/helgrind/tests/tc08_hbl2.c
Modified: trunk/helgrind/tests/tc08_hbl2.c
===================================================================
--- trunk/helgrind/tests/tc08_hbl2.c 2011-10-23 12:34:07 UTC (rev 12215)
+++ trunk/helgrind/tests/tc08_hbl2.c 2011-10-23 13:28:20 UTC (rev 12216)
@@ -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;
}
|