# HG changeset patch # User Richard M. Stallman # Date 895265726 0 # Node ID b7a2370ee82d964bbb51899316ad702c96b123a1 # Parent f4099a0f35751394cac390f0d36d0ddf5757fc08 (sys_select): Always wait on interrupt_handle, so that user can break out of `accept-process-input' (for instance) by typing C-g. diff -r f4099a0f3575 -r b7a2370ee82d src/w32proc.c --- a/src/w32proc.c Fri May 15 20:53:53 1998 +0000 +++ b/src/w32proc.c Fri May 15 20:55:26 1998 +0000 @@ -987,10 +987,20 @@ children to be created without a corresponding pipe handle from which to read output, we wait separately on the process handles as well as the char_avail events for each process pipe. We only call - wait/reap_process when the process actually terminates. */ + wait/reap_process when the process actually terminates. + + To reduce the number of places in which Emacs can be hung such that + C-g is not able to interrupt it, we always wait on interrupt_handle + (which is signalled by the input thread when C-g is detected). If we + detect that we were woken up by C-g, we return -1 with errno set to + EINTR as on Unix. */ /* From ntterm.c */ extern HANDLE keyboard_handle; + +/* From w32xfns.c */ +extern HANDLE interrupt_handle; + /* From process.c */ extern int proc_buffered_char[]; @@ -1025,9 +1035,13 @@ orfds = *rfds; FD_ZERO (rfds); nr = 0; + + /* Always wait on interrupt_handle, to detect C-g (quit). */ + wait_hnd[0] = interrupt_handle; + fdindex[0] = -1; /* Build a list of pipe handles to wait on. */ - nh = 0; + nh = 1; for (i = 0; i < nfds; i++) if (FD_ISSET (i, &orfds)) { @@ -1212,6 +1226,12 @@ dead_child = NULL; } } + else if (fdindex[active] == -1) + { + /* Quit (C-g) was detected. */ + errno = EINTR; + return -1; + } else if (fdindex[active] == 0) { /* Keyboard input available */