mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-06-20 14:33:11 -04:00
Use nanosleep
This commit is contained in:
parent
f6c156c3dc
commit
0b9e1fa170
1 changed files with 4 additions and 1 deletions
5
cage.c
5
cage.c
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue