summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-12-15 20:07:04 +0000
committerChris Wilson <chris+github@qwirx.com>2007-12-15 20:07:04 +0000
commit01125f52d57fa9a7245dff75e50169d14700d0a8 (patch)
tree87237c33cf152b856e206f0e990afa8499d2b3f2
parentadc424b47ff67c2e6c1e3e534b59471432e25d00 (diff)
Log sleep time and resleeps in safe_sleep (only used in tests).
-rw-r--r--lib/common/Test.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/common/Test.h b/lib/common/Test.h
index 66e7fc7f..cf7cb713 100644
--- a/lib/common/Test.h
+++ b/lib/common/Test.h
@@ -437,10 +437,17 @@ inline void safe_sleep(int seconds)
Sleep(seconds * 1000);
#else
struct timespec ts;
+ memset(&ts, 0, sizeof(ts));
ts.tv_sec = seconds;
ts.tv_nsec = 0;
+ BOX_TRACE("sleeping for " << seconds << " seconds");
while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
- { /* sleep again */ }
+ {
+ BOX_TRACE("safe_sleep interrupted with " <<
+ ts.tv_sec << "." << ts.tv_nsec <<
+ " secs remaining, sleeping again");
+ /* sleep again */
+ }
#endif
}