aboutsummaryrefslogtreecommitdiffhomepage
path: root/proc.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-10-20 15:50:54 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-10-20 15:50:54 -0700
commit3fe10692199fc20a5f4b6ac5057cce43babc5f36 (patch)
treef8d05cd89560aa5c03ecab438fc7b8dc68c42a90 /proc.h
parent98091faeaf5d553b44ab734744959e0648935f57 (diff)
Stop reaping children from SIGCHLD signal handler
Prior to this fix, a child process may be reaped in one of two ways: 1. By a call to waitpid() within job_continue 2. By a call to waitpid() within the SIGCHLD signal handler Only the second call was with the WNOHANG option. Thus if the signal handler fired first, and then the waitpid call fired, we could get a deadlock because we'd end up waiting on a long-running process. I have not been able to reproduce this on fish 1.x, though it seems like it ought to reproduce there too. This fix migrates the waitpid() call out of the signal handler; the second class of calls moves to job_reap. This eliminates the possibility of a race, because we check for job completion before calling waitpid, and there is no longer the possibility of the job being marked as complete asynchronously. It also results in a massive conceptual simplification, since the signal handler is now very simple and easy to reason about (no more walking jobs lists, etc). This partially fixes a bug reported in #1273
Diffstat (limited to 'proc.h')
-rw-r--r--proc.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/proc.h b/proc.h
index 3f35e69b..94274ced 100644
--- a/proc.h
+++ b/proc.h
@@ -599,5 +599,4 @@ void proc_pop_interactive();
*/
int proc_format_status(int status);
-
#endif