aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNick Roberts2007-05-20 02:41:19 +0000
committerNick Roberts2007-05-20 02:41:19 +0000
commit994d9841e1962f62c273b88790242b5b6dbcb2c2 (patch)
treeff3f16daeed2e96bad55a05245ad48fdd3c0fa0a /src
parent02ed7a7cfb3d78d2cf40d68ad4d79863295d028a (diff)
downloademacs-994d9841e1962f62c273b88790242b5b6dbcb2c2.tar.gz
emacs-994d9841e1962f62c273b88790242b5b6dbcb2c2.zip
(gpm_wait_mask, max_gpm_desc): New variables.
(wait_reading_process_output): Wait on gpm_fd too. (add_gpm_wait_descriptor, delete_gpm_wait_descriptor)): New functions. (add_gpm_wait_descriptor_called_flag): New variable. (delete_keyboard_wait_descriptor): Check gpm_wait_mask.
Diffstat (limited to 'src')
-rw-r--r--src/process.c53
1 files changed, 48 insertions, 5 deletions
diff --git a/src/process.c b/src/process.c
index a129195b415..c248a8144db 100644
--- a/src/process.c
+++ b/src/process.c
@@ -328,14 +328,18 @@ extern int timers_run;
328 328
329static SELECT_TYPE input_wait_mask; 329static SELECT_TYPE input_wait_mask;
330 330
331/* Mask that excludes keyboard input descriptor (s). */ 331/* Mask that excludes keyboard input descriptor(s). */
332 332
333static SELECT_TYPE non_keyboard_wait_mask; 333static SELECT_TYPE non_keyboard_wait_mask;
334 334
335/* Mask that excludes process input descriptor (s). */ 335/* Mask that excludes process input descriptor(s). */
336 336
337static SELECT_TYPE non_process_wait_mask; 337static SELECT_TYPE non_process_wait_mask;
338 338
339/* Mask for the gpm mouse input descriptor. */
340
341static SELECT_TYPE gpm_wait_mask;
342
339#ifdef NON_BLOCKING_CONNECT 343#ifdef NON_BLOCKING_CONNECT
340/* Mask of bits indicating the descriptors that we wait for connect to 344/* Mask of bits indicating the descriptors that we wait for connect to
341 complete on. Once they complete, they are removed from this mask 345 complete on. Once they complete, they are removed from this mask
@@ -357,6 +361,9 @@ static int max_process_desc;
357/* The largest descriptor currently in use for keyboard input. */ 361/* The largest descriptor currently in use for keyboard input. */
358static int max_keyboard_desc; 362static int max_keyboard_desc;
359 363
364/* The largest descriptor currently in use for gpm mouse input. */
365static int max_gpm_desc;
366
360/* Nonzero means delete a process right away if it exits. */ 367/* Nonzero means delete a process right away if it exits. */
361static int delete_exited_processes; 368static int delete_exited_processes;
362 369
@@ -4446,7 +4453,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4446 IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask); 4453 IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask);
4447 4454
4448 EMACS_SET_SECS_USECS (timeout, 0, 0); 4455 EMACS_SET_SECS_USECS (timeout, 0, 0);
4449 if ((select (max (max_process_desc, max_keyboard_desc) + 1, 4456 if ((select (max (max (max_process_desc, max_keyboard_desc),
4457 max_gpm_desc) + 1,
4450 &Atemp, 4458 &Atemp,
4451#ifdef NON_BLOCKING_CONNECT 4459#ifdef NON_BLOCKING_CONNECT
4452 (num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0), 4460 (num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0),
@@ -4591,7 +4599,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4591 } 4599 }
4592#endif 4600#endif
4593 4601
4594 nfds = select (max (max_process_desc, max_keyboard_desc) + 1, 4602 nfds = select (max (max (max_process_desc, max_keyboard_desc),
4603 max_gpm_desc) + 1,
4595 &Available, 4604 &Available,
4596#ifdef NON_BLOCKING_CONNECT 4605#ifdef NON_BLOCKING_CONNECT
4597 (check_connect ? &Connecting : (SELECT_TYPE *)0), 4606 (check_connect ? &Connecting : (SELECT_TYPE *)0),
@@ -6978,6 +6987,21 @@ add_keyboard_wait_descriptor (desc)
6978 max_keyboard_desc = desc; 6987 max_keyboard_desc = desc;
6979} 6988}
6980 6989
6990static int add_gpm_wait_descriptor_called_flag;
6991
6992void
6993add_gpm_wait_descriptor (desc)
6994 int desc;
6995{
6996 if (! add_gpm_wait_descriptor_called_flag)
6997 FD_CLR (0, &input_wait_mask);
6998 add_gpm_wait_descriptor_called_flag = 1;
6999 FD_SET (desc, &input_wait_mask);
7000 FD_SET (desc, &gpm_wait_mask);
7001 if (desc > max_gpm_desc)
7002 max_gpm_desc = desc;
7003}
7004
6981/* From now on, do not expect DESC to give keyboard input. */ 7005/* From now on, do not expect DESC to give keyboard input. */
6982 7006
6983void 7007void
@@ -6993,10 +7017,29 @@ delete_keyboard_wait_descriptor (desc)
6993 if (desc == max_keyboard_desc) 7017 if (desc == max_keyboard_desc)
6994 for (fd = 0; fd < lim; fd++) 7018 for (fd = 0; fd < lim; fd++)
6995 if (FD_ISSET (fd, &input_wait_mask) 7019 if (FD_ISSET (fd, &input_wait_mask)
6996 && !FD_ISSET (fd, &non_keyboard_wait_mask)) 7020 && !FD_ISSET (fd, &non_keyboard_wait_mask)
7021 && !FD_ISSET (fd, &gpm_wait_mask))
6997 max_keyboard_desc = fd; 7022 max_keyboard_desc = fd;
6998} 7023}
6999 7024
7025void
7026delete_gpm_wait_descriptor (desc)
7027 int desc;
7028{
7029 int fd;
7030 int lim = max_gpm_desc;
7031
7032 FD_CLR (desc, &input_wait_mask);
7033 FD_CLR (desc, &non_process_wait_mask);
7034
7035 if (desc == max_gpm_desc)
7036 for (fd = 0; fd < lim; fd++)
7037 if (FD_ISSET (fd, &input_wait_mask)
7038 && !FD_ISSET (fd, &non_keyboard_wait_mask)
7039 && !FD_ISSET (fd, &non_process_wait_mask))
7040 max_gpm_desc = fd;
7041}
7042
7000/* Return nonzero if *MASK has a bit set 7043/* Return nonzero if *MASK has a bit set
7001 that corresponds to one of the keyboard input descriptors. */ 7044 that corresponds to one of the keyboard input descriptors. */
7002 7045