Merge in all of libtest updates.
[m6w6/libmemcached] / libtest / wait.h
index 33c4db54cb838d0c707345d2e199b82494deb074..9c0ae79c9d6d5b25fe62222800bf317d61b406cc 100644 (file)
@@ -55,14 +55,24 @@ public:
 
     for (waited= 0, retry= 1; ; retry++, waited+= this_wait)
     {
-      if ((not access(filename.c_str(), R_OK)) or (waited >= timeout))
+      if (access(filename.c_str(), R_OK) == 0)
       {
         _successful= true;
         break;
       }
+      else if (waited >= timeout)
+      {
+        break;
+      }
 
       this_wait= retry * retry / 3 + 1;
       sleep(this_wait);
+#ifdef WIN32
+      sleep(this_wait);
+#else
+      struct timespec global_sleep_value= { this_wait, 0 };
+      nanosleep(&global_sleep_value, NULL);
+#endif
     }
   }