aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32proc.c
diff options
context:
space:
mode:
authorEli Zaretskii2013-11-28 21:40:15 +0200
committerEli Zaretskii2013-11-28 21:40:15 +0200
commit9c099ca7fd30b424b3e2f183652de888cd9b30b7 (patch)
tree7823c33618b120f588addcfc4321eeeb4e4da901 /src/w32proc.c
parent16555151e0051faad2838505e80fcbd1f744cb9e (diff)
downloademacs-9c099ca7fd30b424b3e2f183652de888cd9b30b7.tar.gz
emacs-9c099ca7fd30b424b3e2f183652de888cd9b30b7.zip
Fix bug #15933 with crashes in file-notify-tests on MS-Windows.
Support w32 file notifications in batch mode. src/w32proc.c (sys_select): Don't wait on interrupt_handle if it is invalid (which happens in batch mode). If non-interactive, call handle_file_notifications to store file notification events in the input queue. src/w32notify.c (send_notifications): Handle FRAME_INITIAL frames as well. src/w32inevt.c (handle_file_notifications): Now external, not static. src/w32term.h (handle_file_notifications): Provide prototype. src/emacs.c (main) [HAVE_W32NOTIFY]: When non-interactive, call init_crit, since init_display, which does that otherwise, is not called.
Diffstat (limited to 'src/w32proc.c')
-rw-r--r--src/w32proc.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/w32proc.c b/src/w32proc.c
index ea16f26a0ee..3e0081cd802 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1960,12 +1960,17 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
1960 FD_ZERO (rfds); 1960 FD_ZERO (rfds);
1961 nr = 0; 1961 nr = 0;
1962 1962
1963 /* Always wait on interrupt_handle, to detect C-g (quit). */ 1963 /* If interrupt_handle is available and valid, always wait on it, to
1964 wait_hnd[0] = interrupt_handle; 1964 detect C-g (quit). */
1965 fdindex[0] = -1; 1965 nh = 0;
1966 if (interrupt_handle && interrupt_handle != INVALID_HANDLE_VALUE)
1967 {
1968 wait_hnd[0] = interrupt_handle;
1969 fdindex[0] = -1;
1970 nh++;
1971 }
1966 1972
1967 /* Build a list of pipe handles to wait on. */ 1973 /* Build a list of pipe handles to wait on. */
1968 nh = 1;
1969 for (i = 0; i < nfds; i++) 1974 for (i = 0; i < nfds; i++)
1970 if (FD_ISSET (i, &orfds)) 1975 if (FD_ISSET (i, &orfds))
1971 { 1976 {
@@ -1986,6 +1991,11 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
1986 FD_SET (i, rfds); 1991 FD_SET (i, rfds);
1987 return 1; 1992 return 1;
1988 } 1993 }
1994 else if (noninteractive)
1995 {
1996 if (handle_file_notifications (NULL))
1997 return 1;
1998 }
1989 } 1999 }
1990 else 2000 else
1991 { 2001 {
@@ -2086,6 +2096,11 @@ count_children:
2086 { 2096 {
2087 if (timeout) 2097 if (timeout)
2088 Sleep (timeout_ms); 2098 Sleep (timeout_ms);
2099 if (noninteractive)
2100 {
2101 if (handle_file_notifications (NULL))
2102 return 1;
2103 }
2089 return 0; 2104 return 0;
2090 } 2105 }
2091 2106
@@ -2112,6 +2127,11 @@ count_children:
2112 } 2127 }
2113 else if (active == WAIT_TIMEOUT) 2128 else if (active == WAIT_TIMEOUT)
2114 { 2129 {
2130 if (noninteractive)
2131 {
2132 if (handle_file_notifications (NULL))
2133 return 1;
2134 }
2115 return 0; 2135 return 0;
2116 } 2136 }
2117 else if (active >= WAIT_OBJECT_0 2137 else if (active >= WAIT_OBJECT_0
@@ -2218,6 +2238,12 @@ count_children:
2218 break; 2238 break;
2219 } while (active < nh + nc); 2239 } while (active < nh + nc);
2220 2240
2241 if (noninteractive)
2242 {
2243 if (handle_file_notifications (NULL))
2244 nr++;
2245 }
2246
2221 /* If no input has arrived and timeout hasn't expired, wait again. */ 2247 /* If no input has arrived and timeout hasn't expired, wait again. */
2222 if (nr == 0) 2248 if (nr == 0)
2223 { 2249 {