aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/process.c b/src/process.c
index 0631cb732bf..3e31dede4c2 100644
--- a/src/process.c
+++ b/src/process.c
@@ -7060,13 +7060,29 @@ integer or floating point values.
7060 return system_process_attributes (pid); 7060 return system_process_attributes (pid);
7061} 7061}
7062 7062
7063#ifndef NS_IMPL_GNUSTEP 7063/* Arrange to catch SIGCHLD if needed. */
7064static 7064
7065#endif
7066void 7065void
7067catch_child_signal (void) 7066catch_child_signal (void)
7068{ 7067{
7069 struct sigaction action, old_action; 7068 struct sigaction action, old_action;
7069
7070#if !defined CANNOT_DUMP
7071 if (noninteractive && !initialized)
7072 return;
7073#endif
7074
7075#if defined HAVE_GLIB && !defined WINDOWSNT
7076 /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
7077 this should always fail, but is enough to initialize glib's
7078 private SIGCHLD handler, allowing the code below to copy it into
7079 LIB_CHILD_HANDLER.
7080
7081 Do this early in Emacs initialization, before glib creates
7082 threads, to avoid race condition bugs in Cygwin glib. */
7083 g_source_unref (g_child_watch_source_new (getpid ()));
7084#endif
7085
7070 emacs_sigaction_init (&action, deliver_child_signal); 7086 emacs_sigaction_init (&action, deliver_child_signal);
7071 sigaction (SIGCHLD, &action, &old_action); 7087 sigaction (SIGCHLD, &action, &old_action);
7072 eassert (! (old_action.sa_flags & SA_SIGINFO)); 7088 eassert (! (old_action.sa_flags & SA_SIGINFO));
@@ -7086,19 +7102,6 @@ init_process_emacs (void)
7086 7102
7087 inhibit_sentinels = 0; 7103 inhibit_sentinels = 0;
7088 7104
7089#ifndef CANNOT_DUMP
7090 if (! noninteractive || initialized)
7091#endif
7092 {
7093#if defined HAVE_GLIB && !defined WINDOWSNT
7094 /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
7095 this should always fail, but is enough to initialize glib's
7096 private SIGCHLD handler. */
7097 g_source_unref (g_child_watch_source_new (getpid ()));
7098#endif
7099 catch_child_signal ();
7100 }
7101
7102 FD_ZERO (&input_wait_mask); 7105 FD_ZERO (&input_wait_mask);
7103 FD_ZERO (&non_keyboard_wait_mask); 7106 FD_ZERO (&non_keyboard_wait_mask);
7104 FD_ZERO (&non_process_wait_mask); 7107 FD_ZERO (&non_process_wait_mask);