mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-20 05:33:47 -04:00
reaper: new module, uses a signalfd to wait() on child processes
Use a signalfd to listen for SIGCHLD signals. When we receive a SIGCHLD over the signalfd, reap all dead children by looping over all registered child PIDs and call waitpid(WNOHANG) on them.
This commit is contained in:
parent
5600cc68c0
commit
f49742ebba
4 changed files with 161 additions and 0 deletions
6
main.c
6
main.c
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "fdm.h"
|
||||
#include "reaper.h"
|
||||
#include "render.h"
|
||||
#include "server.h"
|
||||
#include "shm.h"
|
||||
|
|
@ -353,6 +354,7 @@ main(int argc, char *const *argv)
|
|||
conf.hold_at_exit = hold;
|
||||
|
||||
struct fdm *fdm = NULL;
|
||||
struct reaper *reaper = NULL;
|
||||
struct wayland *wayl = NULL;
|
||||
struct renderer *renderer = NULL;
|
||||
struct terminal *term = NULL;
|
||||
|
|
@ -378,6 +380,9 @@ main(int argc, char *const *argv)
|
|||
if ((fdm = fdm_init()) == NULL)
|
||||
goto out;
|
||||
|
||||
if ((reaper = reaper_init(fdm)) == NULL)
|
||||
goto out;
|
||||
|
||||
if ((wayl = wayl_init(&conf, fdm)) == NULL)
|
||||
goto out;
|
||||
|
||||
|
|
@ -429,6 +434,7 @@ out:
|
|||
shm_fini();
|
||||
render_destroy(renderer);
|
||||
wayl_destroy(wayl);
|
||||
reaper_destroy(reaper);
|
||||
fdm_destroy(fdm);
|
||||
|
||||
config_free(conf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue