aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-03-06 19:17:17 +0000
committerRichard M. Stallman1996-03-06 19:17:17 +0000
commit87dd9b9b9d89c208b1a3feea7a6af2193a436ec9 (patch)
tree62c51e71c865242f963df2575772bb8eba55c37e /src
parent822bd8045d9193019a371c3685a634f68ea47712 (diff)
downloademacs-87dd9b9b9d89c208b1a3feea7a6af2193a436ec9.tar.gz
emacs-87dd9b9b9d89c208b1a3feea7a6af2193a436ec9.zip
(timers_run): New variable, incremented when a timer is
run directly. (timer_check, swallow_events): Increment timers_run. (swallow_events): Redisplay if get_input_pending has run timers. (detect_input_pending_run_timers): New arg DO_DISPLAY. (init_keyboard): Initialize timer_idleness_start_time. (reinvoke_input_signal): Use getpid. (input_poll_signal): Use start_polling after first incrementing poll_suppress_count.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index e7432239103..9a30170d18d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -480,6 +480,9 @@ Lisp_Object Vtimer_list;
480/* List of idle time timers. Appears in order of next scheduled event. */ 480/* List of idle time timers. Appears in order of next scheduled event. */
481Lisp_Object Vtimer_idle_list; 481Lisp_Object Vtimer_idle_list;
482 482
483/* Incremented whenever a timer is run. */
484int timers_run;
485
483extern Lisp_Object Vprint_level, Vprint_length; 486extern Lisp_Object Vprint_level, Vprint_length;
484 487
485/* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt 488/* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt
@@ -493,7 +496,7 @@ int interrupt_input;
493/* Nonzero while interrupts are temporarily deferred during redisplay. */ 496/* Nonzero while interrupts are temporarily deferred during redisplay. */
494int interrupts_deferred; 497int interrupts_deferred;
495 498
496/* nonzero means use ^S/^Q for flow control. */ 499/* Nonzero means use ^S/^Q for flow control. */
497int flow_control; 500int flow_control;
498 501
499/* Allow m- file to inhibit use of FIONREAD. */ 502/* Allow m- file to inhibit use of FIONREAD. */
@@ -1475,11 +1478,15 @@ SIGTYPE
1475input_poll_signal (signalnum) /* If we don't have an argument, */ 1478input_poll_signal (signalnum) /* If we don't have an argument, */
1476 int signalnum; /* some compilers complain in signal calls. */ 1479 int signalnum; /* some compilers complain in signal calls. */
1477{ 1480{
1481 /* This causes the call to start_polling at the end
1482 to do its job. It also arranges for a quit or error
1483 from within read_avail_input to resume polling. */
1484 poll_suppress_count++;
1478 if (interrupt_input_blocked == 0 1485 if (interrupt_input_blocked == 0
1479 && !waiting_for_input) 1486 && !waiting_for_input)
1480 read_avail_input (0); 1487 read_avail_input (0);
1481 signal (SIGALRM, input_poll_signal); 1488 /* Turn on the SIGALRM handler and request another alarm. */
1482 alarm (polling_period); 1489 start_polling ();
1483} 1490}
1484 1491
1485#endif 1492#endif
@@ -2803,6 +2810,8 @@ void
2803swallow_events (do_display) 2810swallow_events (do_display)
2804 int do_display; 2811 int do_display;
2805{ 2812{
2813 int old_timers_run;
2814
2806 while (kbd_fetch_ptr != kbd_store_ptr) 2815 while (kbd_fetch_ptr != kbd_store_ptr)
2807 { 2816 {
2808 struct input_event *event; 2817 struct input_event *event;
@@ -2865,6 +2874,7 @@ swallow_events (do_display)
2865 if (kbd_fetch_ptr == kbd_store_ptr) 2874 if (kbd_fetch_ptr == kbd_store_ptr)
2866 input_pending = 0; 2875 input_pending = 0;
2867 Fcommand_execute (tem, Qnil, Fvector (1, &lisp_event), Qt); 2876 Fcommand_execute (tem, Qnil, Fvector (1, &lisp_event), Qt);
2877 timers_run++;
2868 if (do_display) 2878 if (do_display)
2869 redisplay_preserve_echo_area (); 2879 redisplay_preserve_echo_area ();
2870 2880
@@ -2876,7 +2886,11 @@ swallow_events (do_display)
2876 break; 2886 break;
2877 } 2887 }
2878 2888
2889 old_timers_run = timers_run;
2879 get_input_pending (&input_pending, 1); 2890 get_input_pending (&input_pending, 1);
2891
2892 if (timers_run != old_timers_run && do_display)
2893 redisplay_preserve_echo_area ();
2880} 2894}
2881 2895
2882static EMACS_TIME timer_idleness_start_time; 2896static EMACS_TIME timer_idleness_start_time;
@@ -3085,6 +3099,7 @@ timer_check (do_it_now)
3085 1); 3099 1);
3086 event = Fcons (Qtimer_event, Fcons (chosen_timer, Qnil)); 3100 event = Fcons (Qtimer_event, Fcons (chosen_timer, Qnil));
3087 Fcommand_execute (tem, Qnil, Fvector (1, &event), Qt); 3101 Fcommand_execute (tem, Qnil, Fvector (1, &event), Qt);
3102 timers_run++;
3088 3103
3089 /* Resume allowing input from any kboard, if that was true before. */ 3104 /* Resume allowing input from any kboard, if that was true before. */
3090 if (!was_locked) 3105 if (!was_locked)
@@ -3111,6 +3126,12 @@ timer_check (do_it_now)
3111 events_generated = 1; 3126 events_generated = 1;
3112 EMACS_SET_SECS (nexttime, 0); 3127 EMACS_SET_SECS (nexttime, 0);
3113 EMACS_SET_USECS (nexttime, 0); 3128 EMACS_SET_USECS (nexttime, 0);
3129
3130 /* Don't queue more than one event at once.
3131 When Emacs is ready for another, it will
3132 queue the next one. */
3133 UNGCPRO;
3134 return nexttime;
3114 } 3135 }
3115 } 3136 }
3116 } 3137 }
@@ -4867,7 +4888,7 @@ void
4867reinvoke_input_signal () 4888reinvoke_input_signal ()
4868{ 4889{
4869#ifdef SIGIO 4890#ifdef SIGIO
4870 kill (0, SIGIO); 4891 kill (getpid (), SIGIO);
4871#endif 4892#endif
4872} 4893}
4873 4894
@@ -6952,11 +6973,17 @@ detect_input_pending ()
6952/* Return nonzero if input events are pending. 6973/* Return nonzero if input events are pending.
6953 Execute timers immediately; don't make events for them. */ 6974 Execute timers immediately; don't make events for them. */
6954 6975
6955detect_input_pending_run_timers () 6976detect_input_pending_run_timers (do_display)
6977 int do_display;
6956{ 6978{
6979 int old_timers_run = timers_run;
6980
6957 if (!input_pending) 6981 if (!input_pending)
6958 get_input_pending (&input_pending, 1); 6982 get_input_pending (&input_pending, 1);
6959 6983
6984 if (old_timers_run != timers_run && do_display)
6985 redisplay_preserve_echo_area ();
6986
6960 return input_pending; 6987 return input_pending;
6961} 6988}
6962 6989
@@ -7533,6 +7560,7 @@ init_keyboard ()
7533 quit_char = Ctl ('g'); 7560 quit_char = Ctl ('g');
7534 Vunread_command_events = Qnil; 7561 Vunread_command_events = Qnil;
7535 unread_command_char = -1; 7562 unread_command_char = -1;
7563 EMACS_SET_SECS_USECS (timer_idleness_start_time, -1, -1);
7536 total_keys = 0; 7564 total_keys = 0;
7537 recent_keys_index = 0; 7565 recent_keys_index = 0;
7538 kbd_fetch_ptr = kbd_buffer; 7566 kbd_fetch_ptr = kbd_buffer;