From fbfc77472d66ce1c3e2bb14f7031e2d8ed75d422 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 22 Apr 2007 15:49:22 +0000 Subject: Merge [1566] from chris/general: Use Sleep() instead of nanosleep again on win32 (lost in merge [1562]). Fix reference to pCommandLine which no longer exists after [1562]. Fix signed/unsigned comparison warning. (refs #3) --- lib/common/Test.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/common/Test.h b/lib/common/Test.h index 89f74563..716ff563 100644 --- a/lib/common/Test.h +++ b/lib/common/Test.h @@ -99,7 +99,7 @@ inline std::string ConvertPaths(const std::string& rOriginal) // convert UNIX paths to native std::string converted; - for (int i = 0; i < rOriginal.size(); i++) + for (size_t i = 0; i < rOriginal.size(); i++) { if (rOriginal[i] == '/') { @@ -206,7 +206,8 @@ inline int LaunchServer(const std::string& rCommandLine, const char *pidFile) if (result == 0) { DWORD err = GetLastError(); - printf("Launch failed: %s: error %d\n", pCommandLine, (int)err); + printf("Launch failed: %s: error %d\n", rCommandLine.c_str(), + (int)err); return -1; } @@ -402,11 +403,15 @@ inline void wait_for_operation(int seconds) inline void safe_sleep(int seconds) { +#ifdef WIN32 + Sleep(seconds * 1000); +#else struct timespec ts; ts.tv_sec = seconds; ts.tv_nsec = 0; while (nanosleep(&ts, &ts) == -1 && errno == EINTR) { /* sleep again */ } +#endif } #endif // TEST__H -- cgit v1.2.3