Go back to nanosleep since it is in POSIX

This commit is contained in:
Kovid Goyal
2021-01-03 06:45:53 +05:30
parent c869774c58
commit 14d9bcb08a

View File

@@ -20,7 +20,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <time.h>
#ifdef HAS_SENDFILE #ifdef HAS_SENDFILE
#include <sys/sendfile.h> #include <sys/sendfile.h>
#endif #endif
@@ -614,7 +614,8 @@ disk_cache_wait_for_write(PyObject *self_, monotonic_t timeout) {
mutex(unlock); mutex(unlock);
if (!pending) return true; if (!pending) return true;
wakeup_write_loop(self); wakeup_write_loop(self);
usleep(10 * 1000); struct timespec a = { .tv_nsec = 10L * MONOTONIC_T_1e6 }, b; // 10ms sleep
nanosleep(&a, &b);
} }
return false; return false;
} }