From efdd2e5c64957ecd43765763ab59edda56127b08 Mon Sep 17 00:00:00 2001 From: BT Templeton Date: Tue, 17 Sep 2013 23:50:16 -0400 Subject: [PATCH] remove polling suppression * src/eval.c (struct catchtag): Remove `poll_suppress_count' field. All references changed. * src/keyboard.c (poll_suppress_count, stop_polling, set_poll_suppress_count, STOP_POLLING, RESUME_POLLING): Remove. All references changed. (wait_reading_process_output): Turn on atimers unconditionally. --- src/eval.c | 3 -- src/keyboard.c | 78 ++------------------------------------------------ src/keyboard.h | 5 ---- src/lisp.h | 1 - src/process.c | 3 +- src/w32term.c | 9 +----- src/xdisp.c | 13 --------- src/xterm.c | 10 +------ 8 files changed, 5 insertions(+), 117 deletions(-) diff --git a/src/eval.c b/src/eval.c index b34e692f85..a2e9b0f30e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -225,7 +225,6 @@ make_catch_handler (Lisp_Object tag) c->body = Qnil; c->next = handlerlist; c->lisp_eval_depth = lisp_eval_depth; - c->poll_suppress_count = poll_suppress_count; c->interrupt_input_blocked = interrupt_input_blocked; c->ptag = make_prompt_tag (); return c; @@ -242,7 +241,6 @@ make_condition_handler (Lisp_Object tag) c->body = Qnil; c->next = handlerlist; c->lisp_eval_depth = lisp_eval_depth; - c->poll_suppress_count = poll_suppress_count; c->interrupt_input_blocked = interrupt_input_blocked; c->ptag = make_prompt_tag (); return c; @@ -1116,7 +1114,6 @@ static void restore_handler (void *data) { struct handler *c = data; - set_poll_suppress_count (c->poll_suppress_count); unblock_input_to (c->interrupt_input_blocked); immediate_quit = 0; } diff --git a/src/keyboard.c b/src/keyboard.c index b7cf362309..96814aca51 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1973,11 +1973,6 @@ safe_run_hooks (Lisp_Object hook) } -/* Nonzero means polling for input is temporarily suppressed. */ - -int poll_suppress_count; - - #ifdef POLL_FOR_INPUT /* Asynchronous timer for polling. */ @@ -1999,8 +1994,6 @@ poll_for_input_1 (void) static void poll_for_input (struct atimer *timer) { - if (poll_suppress_count == 0) - pending_signals = 1; } #endif /* POLL_FOR_INPUT */ @@ -2035,10 +2028,6 @@ start_polling (void) poll_timer = start_atimer (ATIMER_CONTINUOUS, interval, poll_for_input, NULL); } - - /* Let the timer's callback function poll for input - if this becomes zero. */ - --poll_suppress_count; } #endif } @@ -2058,40 +2047,6 @@ input_polling_used (void) #endif } -/* Turn off polling. */ - -void -stop_polling (void) -{ -#ifdef POLL_FOR_INPUT - /* XXX This condition was (read_socket_hook && !interrupt_input), - but read_socket_hook is not global anymore. Let's pretend that - it's always set. */ - if (!interrupt_input) - ++poll_suppress_count; -#endif -} - -/* Set the value of poll_suppress_count to COUNT - and start or stop polling accordingly. */ - -void -set_poll_suppress_count (int count) -{ -#ifdef POLL_FOR_INPUT - if (count == 0 && poll_suppress_count != 0) - { - poll_suppress_count = 1; - start_polling (); - } - else if (count != 0 && poll_suppress_count == 0) - { - stop_polling (); - } - poll_suppress_count = count; -#endif -} - /* Bind polling_period to a value at least N. But don't decrease it. */ @@ -2099,13 +2054,12 @@ void bind_polling_period (int n) { #ifdef POLL_FOR_INPUT - EMACS_INT new = polling_period; + EMACS_INT new = max (polling_period, new); if (n > new) new = n; stop_other_atimers (poll_timer); - stop_polling (); specbind (Qpolling_period, make_number (new)); /* Start a new alarm with the new period. */ start_polling (); @@ -2233,14 +2187,6 @@ read_char_help_form_unwind (void) Fset_window_configuration (window_config); } -#define STOP_POLLING \ -do { if (! polling_stopped_here) stop_polling (); \ - polling_stopped_here = 1; } while (0) - -#define RESUME_POLLING \ -do { if (polling_stopped_here) start_polling (); \ - polling_stopped_here = 0; } while (0) - static Lisp_Object read_event_from_main_queue (struct timespec *end_time, Lisp_Object local_tag, @@ -2971,8 +2917,6 @@ read_char_1 (bool jump, volatile struct read_char_state *state) wrong_kboard: - STOP_POLLING; - if (NILP (c)) { c = read_decoded_event_from_main_queue (end_time, local_getcjmp, @@ -2996,7 +2940,6 @@ read_char_1 (bool jump, volatile struct read_char_state *state) if (!end_time) timer_stop_idle (); - RESUME_POLLING; if (NILP (c)) { @@ -3310,7 +3253,6 @@ read_char_1 (bool jump, volatile struct read_char_state *state) } exit: - RESUME_POLLING; RETURN_UNGCPRO (c); #undef commandflag #undef map @@ -3746,7 +3688,6 @@ kbd_buffer_store_event_hold (register struct input_event *event, hold_keyboard_input (); if (!noninteractive) ignore_sigio (); - stop_polling (); } #endif /* subprocesses */ } @@ -3910,7 +3851,6 @@ kbd_buffer_get_event (KBOARD **kbp, /* Start reading input again because we have processed enough to be able to accept new events again. */ unhold_keyboard_input (); - start_polling (); } #endif /* subprocesses */ @@ -6871,16 +6811,7 @@ record_asynch_buffer_change (void) event.arg = Qnil; /* Make sure no interrupt happens while storing the event. */ -#ifdef USABLE_SIGIO - if (interrupt_input) - kbd_buffer_store_event (&event); - else -#endif - { - stop_polling (); - kbd_buffer_store_event (&event); - start_polling (); - } + kbd_buffer_store_event (&event); } } @@ -10570,9 +10501,6 @@ See also `current-input-mode'. */) if (new_interrupt_input != interrupt_input) { -#ifdef POLL_FOR_INPUT - stop_polling (); -#endif #ifndef DOS_NT /* this causes startup screen to be restored and messes with the mouse */ reset_all_sys_modes (); @@ -10583,7 +10511,6 @@ See also `current-input-mode'. */) #endif #ifdef POLL_FOR_INPUT - poll_suppress_count = 1; start_polling (); #endif } @@ -10993,7 +10920,6 @@ init_keyboard (void) #ifdef POLL_FOR_INPUT poll_timer = NULL; - poll_suppress_count = 1; start_polling (); #endif } diff --git a/src/keyboard.h b/src/keyboard.h index da83b9b01e..c03ffff1bc 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -231,9 +231,6 @@ extern KBOARD *current_kboard; /* Total number of times read_char has returned, modulo UINTMAX_MAX + 1. */ extern uintmax_t num_input_events; -/* Nonzero means polling for input is temporarily suppressed. */ -extern int poll_suppress_count; - /* Vector holding the key sequence that invoked the current command. It is reused for each command, and it may be longer than the current sequence; this_command_key_count indicates how many elements @@ -456,8 +453,6 @@ extern void temporarily_switch_to_single_kboard (struct frame *); extern void record_asynch_buffer_change (void); extern void input_poll_signal (int); extern void start_polling (void); -extern void stop_polling (void); -extern void set_poll_suppress_count (int); extern int gobble_input (void); extern bool input_polling_used (void); extern void clear_input_pending (void); diff --git a/src/lisp.h b/src/lisp.h index e0a4cdfee1..38d5d3cdd0 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2600,7 +2600,6 @@ struct handler Lisp_Object body; struct handler *next; EMACS_INT lisp_eval_depth; - int poll_suppress_count; int interrupt_input_blocked; }; diff --git a/src/process.c b/src/process.c index 3f5ad06965..e73f65a9b0 100644 --- a/src/process.c +++ b/src/process.c @@ -6665,7 +6665,6 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, /* Turn off periodic alarms (in case they are in use) and then turn off any other atimers, because the select emulator uses alarms. */ - stop_polling (); turn_on_atimers (0); while (1) @@ -6824,7 +6823,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, break; } - start_polling (); + turn_on_atimers (1); return -1; } diff --git a/src/w32term.c b/src/w32term.c index 553764a8de..46b283f208 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -5976,14 +5976,7 @@ x_make_frame_visible (struct frame *f) We used to raise a real alarm, but it seems that the handler isn't always enabled here. This is probably a bug. */ if (input_polling_used ()) - { - /* It could be confusing if a real alarm arrives while processing - the fake one. Turn it off and let the handler reset it. */ - int old_poll_suppress_count = poll_suppress_count; - poll_suppress_count = 1; - poll_for_input_1 (); - poll_suppress_count = old_poll_suppress_count; - } + poll_for_input_1 (); } } } diff --git a/src/xdisp.c b/src/xdisp.c index 5fe278079e..eaffcf03c0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13318,15 +13318,6 @@ propagate_buffer_redisplay (void) } } -#define STOP_POLLING \ -do { if (! polling_stopped_here) stop_polling (); \ - polling_stopped_here = 1; } while (0) - -#define RESUME_POLLING \ -do { if (polling_stopped_here) start_polling (); \ - polling_stopped_here = 0; } while (0) - - /* Perhaps in the future avoid recentering windows if it is not necessary; currently that causes some problems. */ @@ -13831,7 +13822,6 @@ redisplay_internal (void) signals, which can cause an apparent I/O error. */ if (interrupt_input) unrequest_sigio (); - STOP_POLLING; pending |= update_frame (f, 0, 0); f->cursor_type_changed = 0; @@ -13888,7 +13878,6 @@ redisplay_internal (void) which can cause an apparent I/O error. */ if (interrupt_input) unrequest_sigio (); - STOP_POLLING; if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf)) { @@ -13966,7 +13955,6 @@ redisplay_internal (void) But it is much hairier to try to do anything about that. */ if (interrupt_input) request_sigio (); - RESUME_POLLING; /* If a frame has become visible which was not before, redisplay again, so that we display it. Expose events for such a frame @@ -14022,7 +14010,6 @@ redisplay_internal (void) request_sigio (); dynwind_end (); - RESUME_POLLING; } diff --git a/src/xterm.c b/src/xterm.c index 2bad2f4c52..fcf526309f 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9003,15 +9003,7 @@ x_make_frame_visible (struct frame *f) that the handler isn't always enabled here. This is probably a bug. */ if (input_polling_used ()) - { - /* It could be confusing if a real alarm arrives while - processing the fake one. Turn it off and let the - handler reset it. */ - int old_poll_suppress_count = poll_suppress_count; - poll_suppress_count = 1; - poll_for_input_1 (); - poll_suppress_count = old_poll_suppress_count; - } + poll_for_input_1 (); if (XPending (FRAME_X_DISPLAY (f))) { -- 2.20.1