diff --git a/kitty/disk-cache.c b/kitty/disk-cache.c index 9e28a94a1..7d8a1735d 100644 --- a/kitty/disk-cache.c +++ b/kitty/disk-cache.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #ifdef HAS_SENDFILE #include #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; }