Use nanosleep(2) instead of usleep(3)

usleep(3) was declared obsolete in POSIX.1-2001 and removed in
POSIX.1-2008 and nanosleep(2) was recommended to be used instead.
This commit is contained in:
Alan Zhao authored and GitHub committed 2024-05-15 18:14:52 -04:00
1 parent 60dfabbeb7
commit aecf3f55ce
2 files changed
+10 -2

No files matched your search

+4 -1
View File
@@ -933,10 +933,13 @@ static void waitToApplyUpdates(void)
OS forcibly closes the pipe), we will unblock. Then we can loop on
kill() until the process is truly gone. */
int x = 0;
struct timespec req;
req.tv_sec = 0;
req.tv_nsec = 100000000;
read(3, &x, sizeof (x));
info("Pipe has closed, waiting for process to fully go away now.");
while (kill(options.waitforprocess, 0) == 0) {
usleep(100000);
nanosleep(&req, NULL);
}
#endif
}