Mercurial > gnulib
diff lib/wait-process.c @ 40238:3ac749aa0041
fatal-signal: Pass the signal number to the action.
* lib/fatal-signal.h (at_fatal_signal): Change the signature.
* lib/fatal-signal.c (action_t): Take the signal number as parameter.
(fatal_signal_handler): Pass the signal number to the action.
* lib/clean-temp.c (cleanup_action): Renamed from cleanup. Take the
signal number as parameter.
(create_temp_dir): Update.
* lib/wait-process.c (cleanup_slaves_action): New function.
(register_slave_subprocess): Update at_fatal_signal invocation.
* NEWS: Mention the change.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 16 Mar 2019 22:56:21 +0100 |
parents | b06060465f09 |
children |
line wrap: on
line diff
--- a/lib/wait-process.c Sat Mar 16 17:48:06 2019 +0100 +++ b/lib/wait-process.c Sat Mar 16 22:56:21 2019 +0100 @@ -102,6 +102,14 @@ } } +/* The cleanup action, taking a signal argument. + It gets called asynchronously. */ +static void +cleanup_slaves_action (int sig _GL_UNUSED) +{ + cleanup_slaves (); +} + /* Register a subprocess as being a slave process. This means that the subprocess will be terminated when its creator receives a catchable fatal signal or exits normally. Registration ends when wait_subprocess() @@ -113,7 +121,7 @@ if (!cleanup_slaves_registered) { atexit (cleanup_slaves); - at_fatal_signal (cleanup_slaves); + at_fatal_signal (cleanup_slaves_action); cleanup_slaves_registered = true; }