aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2012-12-29 12:09:49 +0200
committerEli Zaretskii2012-12-29 12:09:49 +0200
commite7ae8039c346fd296c49ceedb718896bf4b27d9a (patch)
treee5d24f0802b6ffbcd0a9c1a8f4e6d5b1f40c8867 /src
parent43ebd12b9a838196e91048ef09c5dba7368ee898 (diff)
downloademacs-e7ae8039c346fd296c49ceedb718896bf4b27d9a.tar.gz
emacs-e7ae8039c346fd296c49ceedb718896bf4b27d9a.zip
More cleanup in handling subprocess exiting on MS-Windows.
src/w32proc.c (reader_thread): Avoid passing NULL handles to SetEvent and WaitForSingleObject.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/w32proc.c12
2 files changed, 17 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 79d1982cc0e..76f6865972c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12012-12-29 Eli Zaretskii <eliz@gnu.org>
2
3 * w32proc.c (reader_thread): Avoid passing NULL handles to
4 SetEvent and WaitForSingleObject.
5
12012-12-28 Paul Eggert <eggert@cs.ucla.edu> 62012-12-28 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 Port EXTERNALLY_VISIBLE to Clang 3.2. 8 Port EXTERNALLY_VISIBLE to Clang 3.2.
diff --git a/src/w32proc.c b/src/w32proc.c
index 5c43a57db29..8977ca38a15 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -970,6 +970,11 @@ reader_thread (void *arg)
970 else 970 else
971 rc = _sys_read_ahead (cp->fd); 971 rc = _sys_read_ahead (cp->fd);
972 972
973 /* Don't bother waiting for the event if we already have been
974 told to exit by delete_child. */
975 if (cp->status == STATUS_READ_ERROR || !cp->char_avail)
976 break;
977
973 /* The name char_avail is a misnomer - it really just means the 978 /* The name char_avail is a misnomer - it really just means the
974 read-ahead has completed, whether successfully or not. */ 979 read-ahead has completed, whether successfully or not. */
975 if (!SetEvent (cp->char_avail)) 980 if (!SetEvent (cp->char_avail))
@@ -986,6 +991,11 @@ reader_thread (void *arg)
986 if (rc == STATUS_READ_FAILED) 991 if (rc == STATUS_READ_FAILED)
987 break; 992 break;
988 993
994 /* Don't bother waiting for the acknowledge if we already have
995 been told to exit by delete_child. */
996 if (cp->status == STATUS_READ_ERROR || !cp->char_consumed)
997 break;
998
989 /* Wait until our input is acknowledged before reading again */ 999 /* Wait until our input is acknowledged before reading again */
990 if (WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0) 1000 if (WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0)
991 { 1001 {
@@ -993,6 +1003,8 @@ reader_thread (void *arg)
993 "%lu for fd %ld\n", GetLastError (), cp->fd)); 1003 "%lu for fd %ld\n", GetLastError (), cp->fd));
994 break; 1004 break;
995 } 1005 }
1006 /* delete_child sets status to STATUS_READ_ERROR when it wants
1007 us to exit. */
996 if (cp->status == STATUS_READ_ERROR) 1008 if (cp->status == STATUS_READ_ERROR)
997 break; 1009 break;
998 } 1010 }