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
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

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