aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorKarl Heuer1996-03-14 05:20:44 +0000
committerKarl Heuer1996-03-14 05:20:44 +0000
commitf694e5d2715efbef6009b2e677a7614dcae39f1c (patch)
tree8f114f730ba60d360296ed6f4c2a20a244ffd257 /src/process.c
parent030b04b3d8c6f21748223b1ae40015de9b4d06d3 (diff)
downloademacs-f694e5d2715efbef6009b2e677a7614dcae39f1c.tar.gz
emacs-f694e5d2715efbef6009b2e677a7614dcae39f1c.zip
(wait_reading_process_input) [! subprocesses]: Run
timers and redisplay if they were run, like the code for systems which support subprocesses does.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c78
1 files changed, 42 insertions, 36 deletions
diff --git a/src/process.c b/src/process.c
index 9d4e3aa2db6..49fd0597a06 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3794,6 +3794,8 @@ The value takes effect when `start-process' is called.");
3794 3794
3795extern int frame_garbaged; 3795extern int frame_garbaged;
3796 3796
3797extern EMACS_TIME timer_check ();
3798extern int timers_run;
3797 3799
3798/* As described above, except assuming that there are no subprocesses: 3800/* As described above, except assuming that there are no subprocesses:
3799 3801
@@ -3823,15 +3825,13 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
3823 Lisp_Object read_kbd; 3825 Lisp_Object read_kbd;
3824 int do_display; 3826 int do_display;
3825{ 3827{
3826 EMACS_TIME end_time, timeout, *timeout_p; 3828 EMACS_TIME end_time, timeout;
3827 SELECT_TYPE waitchannels; 3829 SELECT_TYPE waitchannels;
3830 int xerrno;
3828 3831
3829 /* What does time_limit really mean? */ 3832 /* What does time_limit really mean? */
3830 if (time_limit || microsecs) 3833 if (time_limit || microsecs)
3831 { 3834 {
3832 /* It's not infinite. */
3833 timeout_p = &timeout;
3834
3835 if (time_limit == -1) 3835 if (time_limit == -1)
3836 /* In fact, it's zero. */ 3836 /* In fact, it's zero. */
3837 EMACS_SET_SECS_USECS (timeout, 0, 0); 3837 EMACS_SET_SECS_USECS (timeout, 0, 0);
@@ -3844,7 +3844,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
3844 } 3844 }
3845 else 3845 else
3846 /* It's infinite. */ 3846 /* It's infinite. */
3847 timeout_p = 0; 3847 EMACS_SET_SECS_USECS (timeout, 100000, 0);
3848 3848
3849 /* Turn off periodic alarms (in case they are in use) 3849 /* Turn off periodic alarms (in case they are in use)
3850 because the select emulator uses alarms. */ 3850 because the select emulator uses alarms. */
@@ -3868,11 +3868,11 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
3868 3868
3869 /* Compute time from now till when time limit is up */ 3869 /* Compute time from now till when time limit is up */
3870 /* Exit if already run out */ 3870 /* Exit if already run out */
3871 if (timeout_p) 3871 if (time_limit > 0 || microsecs)
3872 { 3872 {
3873 EMACS_GET_TIME (*timeout_p); 3873 EMACS_GET_TIME (timeout);
3874 EMACS_SUB_TIME (*timeout_p, end_time, *timeout_p); 3874 EMACS_SUB_TIME (timeout, end_time, timeout);
3875 if (EMACS_TIME_NEG_P (*timeout_p)) 3875 if (EMACS_TIME_NEG_P (timeout))
3876 break; 3876 break;
3877 } 3877 }
3878 3878
@@ -3880,20 +3880,20 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
3880 run timer events directly. 3880 run timer events directly.
3881 (Callers that will immediately read keyboard events 3881 (Callers that will immediately read keyboard events
3882 call timer_delay on their own.) */ 3882 call timer_delay on their own.) */
3883 if (read_kbd >= 0) 3883 if (XINT (read_kbd) >= 0)
3884 { 3884 {
3885 EMACS_TIME timer_delay; 3885 EMACS_TIME timer_delay;
3886 int old_timers_run = timers_run; 3886 int old_timers_run = timers_run;
3887 timer_delay = timer_check (1); 3887 timer_delay = timer_check (1);
3888 if (timers_run != old_timers_run && do_display) 3888 if (timers_run != old_timers_run && do_display)
3889 redisplay_preserve_echo_area (); 3889 redisplay_preserve_echo_area ();
3890 if (! EMACS_TIME_NEG_P (timer_delay) && timeout_p) 3890 if (! EMACS_TIME_NEG_P (timer_delay) && time_limit != -1)
3891 { 3891 {
3892 EMACS_TIME difference; 3892 EMACS_TIME difference;
3893 EMACS_SUB_TIME (difference, timer_delay, *timeout_p); 3893 EMACS_SUB_TIME (difference, timer_delay, timeout);
3894 if (EMACS_TIME_NEG_P (difference)) 3894 if (EMACS_TIME_NEG_P (difference))
3895 { 3895 {
3896 *timeout_p = timer_delay; 3896 timeout = timer_delay;
3897 timeout_reduced_for_timers = 1; 3897 timeout_reduced_for_timers = 1;
3898 } 3898 }
3899 } 3899 }
@@ -3909,25 +3909,13 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
3909 if (frame_garbaged && do_display) 3909 if (frame_garbaged && do_display)
3910 redisplay_preserve_echo_area (); 3910 redisplay_preserve_echo_area ();
3911 3911
3912 nfds = 1; 3912 if (XINT (read_kbd) && detect_input_pending ())
3913 if (XINT (read_kbd) < 0 && detect_input_pending ()) 3913 nfds = 0;
3914 { 3914 else
3915 swallow_events (do_display);
3916 if (detect_input_pending ())
3917 nfds = 0;
3918 }
3919
3920 if ((XINT (read_kbd) > 0)
3921 && detect_input_pending_run_timers (do_display))
3922 {
3923 swallow_events (do_display);
3924 if (detect_input_pending_run_timers (do_display))
3925 nfds = 0;
3926 }
3927
3928 if (nfds)
3929 nfds = select (1, &waitchannels, (SELECT_TYPE *)0, (SELECT_TYPE *)0, 3915 nfds = select (1, &waitchannels, (SELECT_TYPE *)0, (SELECT_TYPE *)0,
3930 timeout_p); 3916 &timeout);
3917
3918 xerrno = errno;
3931 3919
3932 /* Make C-g and alarm signals set flags again */ 3920 /* Make C-g and alarm signals set flags again */
3933 clear_waiting_for_input (); 3921 clear_waiting_for_input ();
@@ -3935,12 +3923,18 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
3935 /* If we woke up due to SIGWINCH, actually change size now. */ 3923 /* If we woke up due to SIGWINCH, actually change size now. */
3936 do_pending_window_change (); 3924 do_pending_window_change ();
3937 3925
3926 if (time_limit && nfds == 0 && ! timeout_reduced_for_timers)
3927 /* We waited the full specified time, so return now. */
3928 break;
3929
3938 if (nfds == -1) 3930 if (nfds == -1)
3939 { 3931 {
3940 /* If the system call was interrupted, then go around the 3932 /* If the system call was interrupted, then go around the
3941 loop again. */ 3933 loop again. */
3942 if (errno == EINTR) 3934 if (xerrno == EINTR)
3943 FD_ZERO (&waitchannels); 3935 FD_ZERO (&waitchannels);
3936 else
3937 error ("select error: %s", strerror (xerrno));
3944 } 3938 }
3945#ifdef sun 3939#ifdef sun
3946 else if (nfds > 0 && (waitchannels & 1) && interrupt_input) 3940 else if (nfds > 0 && (waitchannels & 1) && interrupt_input)
@@ -3952,10 +3946,22 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
3952 kill (getpid (), SIGIO); 3946 kill (getpid (), SIGIO);
3953#endif 3947#endif
3954 3948
3955 /* If we have timed out (nfds == 0) or found some input (nfds > 0), 3949 /* Check for keyboard input */
3956 we should exit. */ 3950
3957 if (nfds >= 0 && ! timeout_reduced_for_timers) 3951 if (XINT (read_kbd) < 0 && detect_input_pending ())
3958 break; 3952 {
3953 swallow_events (do_display);
3954 if (detect_input_pending ())
3955 break;
3956 }
3957
3958 if (XINT (read_kbd) > 0
3959 && detect_input_pending_run_timers (do_display))
3960 {
3961 swallow_events (do_display);
3962 if (detect_input_pending_run_timers (do_display))
3963 break;
3964 }
3959 } 3965 }
3960 3966
3961 start_polling (); 3967 start_polling ();