bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13086: 24.2.50; Emacs seems to hang at w32proc.c:1126


From: Eli Zaretskii
Subject: bug#13086: 24.2.50; Emacs seems to hang at w32proc.c:1126
Date: Thu, 06 Dec 2012 20:28:02 +0200

> Date: Wed, 05 Dec 2012 21:07:33 -0800
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: stephen_powell@optusnet.com.au, 13086@debbugs.gnu.org
> 
> > inflooping in that case is hardly a Good Thing, is it?
> > And neither is aborting when asserts are enabled.  Perhaps signaling
> > an error would be better.
> 
> If we can't fix the bug, perhaps signaling an error is the
> best we can do, but I'd rather fix the bug.  Generally speaking,
> if there's an internal programming error, Emacs aborts
> rather than signaling an error.

Yes, but we usually do that only if Emacs cannot possibly recover from
that internal error.  If Emacs _can_ continue, then we only abort via
eassert, so that a production version won't crash.  In this case, any
errno except EINTR can simply be ignored.  E.g., if waitpid was
somehow called to wait for a non-existing or wrong process, we don't
care about such a process anyway.

So how about the following change?

=== modified file 'src/sysdep.c'
--- src/sysdep.c        2012-12-03 21:42:12 +0000
+++ src/sysdep.c        2012-12-06 18:25:22 +0000
@@ -287,17 +287,20 @@ get_child_status (pid_t child, int *stat
      so that another thread running glib won't find them.  */
   eassert (0 < child);
 
-  while ((pid = waitpid (child, status, options)) < 0)
-    {
-      /* CHILD must be a child process that has not been reaped, and
-        STATUS and OPTIONS must be valid.  */
-      eassert (errno == EINTR);
-
-      /* Note: the MS-Windows emulation of waitpid calls QUIT
-        internally.  */
-      if (interruptible)
-       QUIT;
-    }
+  do {
+    pid = waitpid (child, status, options);
+    if (pid < 0)
+      {
+       /* CHILD must be a child process that has not been reaped, and
+          STATUS and OPTIONS must be valid.  */
+       eassert (errno == EINTR);
+
+       /* Note: the MS-Windows emulation of waitpid calls QUIT
+          internally.  */
+       if (errno == EINTR && interruptible)
+         QUIT;
+      }
+  } while (pid < 0 && errno == EINTR);
 
   /* If successful and status is requested, tell wait_reading_process_output
      that it needs to wake up and look around.  */







reply via email to

[Prev in Thread] Current Thread [Next in Thread]