[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113138: Clean up SIGCHLD handling a bit.
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r113138: Clean up SIGCHLD handling a bit. |
Date: |
Sat, 22 Jun 2013 19:01:50 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113138
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/14569
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2013-06-22 12:01:47 -0700
message:
Clean up SIGCHLD handling a bit.
* process.c, process.h (catch_child_signal):
Now always extern, even if !NS_IMPL_GNUSTEP.
* process.c (catch_child_signal): Move glib tickler here from
init_process_emacs, so that it's done earlier in Emacs
initialization. Also move the noninteractive && !initialized
check here from init_process_emacs. This is all a bit cleaner for
GNUish platforms, and I hope it works around the Cygwin bug.
* sysdep.c (init_signals): Invoke catch_child_signal here, so
that glib signal handling is tickled before glib creates threads.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/process.c process.c-20091113204419-o5vbwnq5f7feedwu-462
src/process.h process.h-20091113204419-o5vbwnq5f7feedwu-272
src/sysdep.c sysdep.c-20091113204419-o5vbwnq5f7feedwu-448
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-06-22 16:43:39 +0000
+++ b/src/ChangeLog 2013-06-22 19:01:47 +0000
@@ -1,5 +1,16 @@
2013-06-22 Paul Eggert <address@hidden>
+ Clean up SIGCHLD handling a bit (Bug#14569).
+ * process.c, process.h (catch_child_signal):
+ Now always extern, even if !NS_IMPL_GNUSTEP.
+ * process.c (catch_child_signal): Move glib tickler here from
+ init_process_emacs, so that it's done earlier in Emacs
+ initialization. Also move the noninteractive && !initialized
+ check here from init_process_emacs. This is all a bit cleaner for
+ GNUish platforms, and I hope it works around the Cygwin bug.
+ * sysdep.c (init_signals): Invoke catch_child_signal here, so
+ that glib signal handling is tickled before glib creates threads.
+
* process.c (wait_reading_process_output): Avoid int overflow
when reading more than 2 GiB total from a process.
=== modified file 'src/process.c'
--- a/src/process.c 2013-06-22 16:43:39 +0000
+++ b/src/process.c 2013-06-22 19:01:47 +0000
@@ -7060,13 +7060,29 @@
return system_process_attributes (pid);
}
-#ifndef NS_IMPL_GNUSTEP
-static
-#endif
+/* Arrange to catch SIGCHLD if needed. */
+
void
catch_child_signal (void)
{
struct sigaction action, old_action;
+
+#if !defined CANNOT_DUMP
+ if (noninteractive && !initialized)
+ return;
+#endif
+
+#if defined HAVE_GLIB && !defined WINDOWSNT
+ /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
+ this should always fail, but is enough to initialize glib's
+ private SIGCHLD handler, allowing the code below to copy it into
+ LIB_CHILD_HANDLER.
+
+ Do this early in Emacs initialization, before glib creates
+ threads, to avoid race condition bugs in Cygwin glib. */
+ g_source_unref (g_child_watch_source_new (getpid ()));
+#endif
+
emacs_sigaction_init (&action, deliver_child_signal);
sigaction (SIGCHLD, &action, &old_action);
eassert (! (old_action.sa_flags & SA_SIGINFO));
@@ -7086,19 +7102,6 @@
inhibit_sentinels = 0;
-#ifndef CANNOT_DUMP
- if (! noninteractive || initialized)
-#endif
- {
-#if defined HAVE_GLIB && !defined WINDOWSNT
- /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
- this should always fail, but is enough to initialize glib's
- private SIGCHLD handler. */
- g_source_unref (g_child_watch_source_new (getpid ()));
-#endif
- catch_child_signal ();
- }
-
FD_ZERO (&input_wait_mask);
FD_ZERO (&non_keyboard_wait_mask);
FD_ZERO (&non_process_wait_mask);
=== modified file 'src/process.h'
--- a/src/process.h 2013-06-03 18:29:30 +0000
+++ b/src/process.h 2013-06-22 19:01:47 +0000
@@ -217,8 +217,6 @@
extern void delete_read_fd (int fd);
extern void add_write_fd (int fd, fd_callback func, void *data);
extern void delete_write_fd (int fd);
-#ifdef NS_IMPL_GNUSTEP
extern void catch_child_signal (void);
-#endif
INLINE_HEADER_END
=== modified file 'src/sysdep.c'
--- a/src/sysdep.c 2013-03-24 12:59:45 +0000
+++ b/src/sysdep.c 2013-06-22 19:01:47 +0000
@@ -1901,6 +1901,8 @@
sigaction (SIGFPE, &action, 0);
}
+ catch_child_signal ();
+
#ifdef SIGUSR1
add_user_signal (SIGUSR1, "sigusr1");
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113138: Clean up SIGCHLD handling a bit.,
Paul Eggert <=