emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111365: More cleanup in handling sub


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111365: More cleanup in handling subprocess exiting on MS-Windows.
Date: Sat, 29 Dec 2012 12:09:49 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111365
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2012-12-29 12:09:49 +0200
message:
  More cleanup in handling subprocess exiting on MS-Windows.
  
   src/w32proc.c (reader_thread): Avoid passing NULL handles to
   SetEvent and WaitForSingleObject.
modified:
  src/ChangeLog
  src/w32proc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-12-28 03:13:47 +0000
+++ b/src/ChangeLog     2012-12-29 10:09:49 +0000
@@ -1,3 +1,8 @@
+2012-12-29  Eli Zaretskii  <address@hidden>
+
+       * w32proc.c (reader_thread): Avoid passing NULL handles to
+       SetEvent and WaitForSingleObject.
+
 2012-12-28  Paul Eggert  <address@hidden>
 
        Port EXTERNALLY_VISIBLE to Clang 3.2.

=== modified file 'src/w32proc.c'
--- a/src/w32proc.c     2012-12-23 17:06:58 +0000
+++ b/src/w32proc.c     2012-12-29 10:09:49 +0000
@@ -970,6 +970,11 @@
       else
        rc = _sys_read_ahead (cp->fd);
 
+      /* Don't bother waiting for the event if we already have been
+        told to exit by delete_child.  */
+      if (cp->status == STATUS_READ_ERROR || !cp->char_avail)
+       break;
+
       /* The name char_avail is a misnomer - it really just means the
         read-ahead has completed, whether successfully or not. */
       if (!SetEvent (cp->char_avail))
@@ -986,6 +991,11 @@
       if (rc == STATUS_READ_FAILED)
        break;
 
+      /* Don't bother waiting for the acknowledge if we already have
+        been told to exit by delete_child.  */
+      if (cp->status == STATUS_READ_ERROR || !cp->char_consumed)
+       break;
+
       /* Wait until our input is acknowledged before reading again */
       if (WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0)
         {
@@ -993,6 +1003,8 @@
                     "%lu for fd %ld\n", GetLastError (), cp->fd));
          break;
         }
+      /* delete_child sets status to STATUS_READ_ERROR when it wants
+        us to exit.  */
       if (cp->status == STATUS_READ_ERROR)
        break;
     }


reply via email to

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