diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32proc.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/w32proc.c b/src/w32proc.c index 8fcf3382da9..97ab6fcc150 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -1175,9 +1175,15 @@ count_children: | |||
| 1175 | return 0; | 1175 | return 0; |
| 1176 | } | 1176 | } |
| 1177 | 1177 | ||
| 1178 | /* Wait for input or child death to be signalled. */ | ||
| 1179 | start_time = GetTickCount (); | 1178 | start_time = GetTickCount (); |
| 1180 | active = WaitForMultipleObjects (nh + nc, wait_hnd, FALSE, timeout_ms); | 1179 | |
| 1180 | /* Wait for input or child death to be signalled. If user input is | ||
| 1181 | allowed, then also accept window messages. */ | ||
| 1182 | if (FD_ISSET (0, &orfds)) | ||
| 1183 | active = MsgWaitForMultipleObjects (nh + nc, wait_hnd, FALSE, timeout_ms, | ||
| 1184 | QS_ALLINPUT); | ||
| 1185 | else | ||
| 1186 | active = WaitForMultipleObjects (nh + nc, wait_hnd, FALSE, timeout_ms); | ||
| 1181 | 1187 | ||
| 1182 | if (active == WAIT_FAILED) | 1188 | if (active == WAIT_FAILED) |
| 1183 | { | 1189 | { |
| @@ -1213,7 +1219,26 @@ count_children: | |||
| 1213 | processed - otherwise higher numbered channels could be starved. */ | 1219 | processed - otherwise higher numbered channels could be starved. */ |
| 1214 | do | 1220 | do |
| 1215 | { | 1221 | { |
| 1216 | if (active >= nh) | 1222 | if (active == nh + nc) |
| 1223 | { | ||
| 1224 | /* There are messages in the lisp thread's queue; we must | ||
| 1225 | drain the queue now to ensure they are processed promptly, | ||
| 1226 | because if we don't do so, we will not be woken again until | ||
| 1227 | further messages arrive. | ||
| 1228 | |||
| 1229 | NB. If ever we allow window message procedures to callback | ||
| 1230 | into lisp, we will need to ensure messages are dispatched | ||
| 1231 | at a safe time for lisp code to be run (*), and we may also | ||
| 1232 | want to provide some hooks in the dispatch loop to cater | ||
| 1233 | for modeless dialogs created by lisp (ie. to register | ||
| 1234 | window handles to pass to IsDialogMessage). | ||
| 1235 | |||
| 1236 | (*) Note that MsgWaitForMultipleObjects above is an | ||
| 1237 | internal dispatch point for messages that are sent to | ||
| 1238 | windows created by this thread. */ | ||
| 1239 | drain_message_queue (); | ||
| 1240 | } | ||
| 1241 | else if (active >= nh) | ||
| 1217 | { | 1242 | { |
| 1218 | cp = cps[active - nh]; | 1243 | cp = cps[active - nh]; |
| 1219 | 1244 | ||