emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111050: Possibly fix bug #13086 w


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111050: Possibly fix bug #13086 with losing track of subprocesses on MS-Windows.
Date: Fri, 21 Dec 2012 13:21:35 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111050
fixes bug: http://debbugs.gnu.org/13086
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Fri 2012-12-21 13:21:35 +0200
message:
  Possibly fix bug #13086 with losing track of subprocesses on MS-Windows.
  
   src/w32proc.c (new_child, delete_child, find_child_pid): For a
   subprocess, consider its slot being in use as long as its process
   handle (procinfo.hProcess) is not NULL.  This avoids reusing the
   slot when a new process is started immediately after killing
   another one, without waiting enough time for the first process to
   be reaped and resources allocated for it be orderly freed.
   Suggested by Fabrice Popineau <address@hidden>.
modified:
  src/ChangeLog
  src/w32proc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-12-21 08:04:27 +0000
+++ b/src/ChangeLog     2012-12-21 11:21:35 +0000
@@ -1,3 +1,14 @@
+2012-12-21  Eli Zaretskii  <address@hidden>
+
+       * w32proc.c (new_child, delete_child, find_child_pid): For a
+       subprocess, consider its slot being in use as long as its process
+       handle (procinfo.hProcess) is not NULL.  This avoids reusing the
+       slot when a new process is started immediately after killing
+       another one, without waiting enough time for the first process to
+       be reaped and resources allocated for it be orderly freed.
+       (Bug#13086)
+       Suggested by Fabrice Popineau <address@hidden>.
+
 2012-12-21  Chong Yidong  <address@hidden>
 
        * buffer.c (Fset_buffer_major_mode): Doc fix (Bug#13231).

=== modified file 'src/w32proc.c'
--- a/src/w32proc.c     2012-11-24 08:24:11 +0000
+++ b/src/w32proc.c     2012-12-21 11:21:35 +0000
@@ -795,7 +795,7 @@
   DWORD id;
 
   for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
-    if (!CHILD_ACTIVE (cp))
+    if (!CHILD_ACTIVE (cp) && cp->procinfo.hProcess == NULL)
       goto Initialize;
   if (child_proc_count == MAX_CHILDREN)
     return NULL;
@@ -852,7 +852,7 @@
     if (fd_info[i].cp == cp)
       emacs_abort ();
 
-  if (!CHILD_ACTIVE (cp))
+  if (!CHILD_ACTIVE (cp) && cp->procinfo.hProcess == NULL)
     return;
 
   /* reap thread if necessary */
@@ -896,7 +896,8 @@
   if (cp == child_procs + child_proc_count - 1)
     {
       for (i = child_proc_count-1; i >= 0; i--)
-       if (CHILD_ACTIVE (&child_procs[i]))
+       if (CHILD_ACTIVE (&child_procs[i])
+           || child_procs[i].procinfo.hProcess != NULL)
          {
            child_proc_count = i + 1;
            break;
@@ -913,7 +914,8 @@
   child_process *cp;
 
   for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
-    if (CHILD_ACTIVE (cp) && pid == cp->pid)
+    if ((CHILD_ACTIVE (cp) || cp->procinfo.hProcess != NULL)
+       && pid == cp->pid)
       return cp;
   return NULL;
 }


reply via email to

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