Improve handling of subprocess shutdown on MS-Windows.
authorEli Zaretskii <eliz@gnu.org>
Sun, 23 Dec 2012 17:06:58 +0000 (19:06 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sun, 23 Dec 2012 17:06:58 +0000 (19:06 +0200)
commit299614f3bcac13be9a17d038f247856e384d9dbd
tree3a1121979e537c9eaf053573a8e92e9ccf95119a
parent9c3dcdaafa79daaaeb26fb41ec0df1ead50c330b
Improve handling of subprocess shutdown on MS-Windows.

 src/w32proc.c (reader_thread): Do not index fd_info[] with negative
 values.
 (reader_thread): Exit when cp->status becomes STATUS_READ_ERROR
 after WaitForSingleObject returns normally.  This expedites reader
 thread shutdown when delete_child triggers it.
 (reap_subprocess): More accurate commentary for why we call
 delete_child only when cp->fd is negative.
 src/w32.c (sys_close): Do not call delete_child on a subprocess
 whose handle is not yet closed.  Instead, set its file descriptor
 to a negative value, so that reap_subprocess will call
 delete_child on that subprocess when its SIGCHLD arrives.  This
 avoids closing handles used for communications between sys_select
 and reader_thread, which doesn't give sys_select a chance to
 notice that the process exited and invoke the SIGCHLD handler for
 it.
src/ChangeLog
src/w32.c
src/w32proc.c