• Eli Zaretskii's avatar
    Improve handling of subprocess shutdown on MS-Windows. · 299614f3
    Eli Zaretskii authored
     src/w32proc.c (reader_thread): Do not index fd_info[] with negative
     (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
w32proc.c 89.4 KB