mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-15 08:21:03 -04:00
reaper: monitor SIGCHLD using the FDM instead of via a signalfd
In addition to letting the FDM do the low-level signal watching, this patch also fixes a bug; multiple SIGCHLDs, be it delivered either through a signal, or via a signalfd, can be coalesced, like all signals. This means we need to loop on waitpid() with WNOHANG until there are no more processes to reap. This in turn requires a small change to the way reaper callbacks are implemented. Previously, the callback was allowed to do the wait(). This was signalled back to the reaper through the callback’s return value. Now, since we’ve already wait():ed, the process’ exit status is passed as an argument to the reaper callback. The callback for the client application has been updated accordingly; it sets a flag in the terminal struct, telling term_destroy() that the process has already been wait():ed on, and also stores the exit status.
This commit is contained in:
parent
37220fc189
commit
79e3a46943
4 changed files with 92 additions and 140 deletions
|
|
@ -487,8 +487,9 @@ struct terminal {
|
|||
} ime;
|
||||
#endif
|
||||
|
||||
bool quit;
|
||||
bool is_shutting_down;
|
||||
bool slave_has_been_reaped;
|
||||
int exit_status;
|
||||
void (*shutdown_cb)(void *data, int exit_code);
|
||||
void *shutdown_data;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue