X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fwait.h;h=9c0ae79c9d6d5b25fe62222800bf317d61b406cc;hb=9bdee8f89d770307eccf292d1d404fc4049c7976;hp=33c4db54cb838d0c707345d2e199b82494deb074;hpb=7abcaebdc4c3dd11b779eaef58a7371fb82ae888;p=m6w6%2Flibmemcached diff --git a/libtest/wait.h b/libtest/wait.h index 33c4db54..9c0ae79c 100644 --- a/libtest/wait.h +++ b/libtest/wait.h @@ -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 } }