Use nanosleep

This commit is contained in:
xorrvin 2026-06-15 20:11:15 +02:00
parent f6c156c3dc
commit 0b9e1fa170

5
cage.c
View file

@ -201,12 +201,15 @@ cleanup_primary_client(pid_t pid)
wlr_log(WLR_DEBUG, "Sending SIGTERM to child with pid %d", pid);
kill(pid, SIGTERM);
/* 100 ms in nanoseconds */
struct timespec ts = {0, 100000000};
/* 10 sec timeout with 100ms intervals */
for(int i = 0; i < 100; i++) {
if(waitpid(pid, &status, WNOHANG) > 0) {
goto done;
}
usleep(100000);
nanosleep(&ts, NULL);
}
wlr_log(WLR_INFO, "Child did not exit after 10s, sending SIGKILL");