emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pretest next week


From: Chong Yidong
Subject: Re: Pretest next week
Date: Wed, 28 Jan 2009 15:52:25 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> we should probably create a new var `pending_signals', which should
> always reflect "pending_timers || interrupt_input_pending", then QUIT
> can check this var, and if set, it can call a new function
> `process_pending_signals' which will then look at pending_timers and
> interrupt_input_pending to figure out which function(s) to call.
>
> pending_timers and process_pending_timers are desired/needed to reduce
> the code-size (the QUIT macro is expanded at many places), as well as to
> reduce the polling overhead.

So basically any place in the code that sets pending_atimers or
interrupt_input_pending would have to set pending_signals as
well---something like in the attached patch?

It's not clear to me whether we want to process pending atimers in the
QUIT macro outside of NS.  Do we?



*** trunk/src/lisp.h.~1.649.~   2009-01-28 13:34:25.000000000 -0500
--- trunk/src/lisp.h    2009-01-28 15:46:38.000000000 -0500
***************
*** 1843,1850 ****
     and (in particular) cannot call arbitrary Lisp code.  */
  
  #ifdef SYNC_INPUT
! extern void handle_async_input P_ ((void));
! extern int interrupt_input_pending;
  
  #define QUIT                                          \
    do {                                                        \
--- 1843,1850 ----
     and (in particular) cannot call arbitrary Lisp code.  */
  
  #ifdef SYNC_INPUT
! extern void process_pending_signals P_ ((void));
! extern int pending_signals;
  
  #define QUIT                                          \
    do {                                                        \
***************
*** 1856,1863 ****
          Fthrow (Vthrow_on_input, Qt);                 \
        Fsignal (Qquit, Qnil);                          \
        }                                                       \
!     else if (interrupt_input_pending)                 \
!       handle_async_input ();                          \
    } while (0)
  
  #else  /* not SYNC_INPUT */
--- 1856,1863 ----
          Fthrow (Vthrow_on_input, Qt);                 \
        Fsignal (Qquit, Qnil);                          \
        }                                                       \
!     else if (pending_signals)                         \
!       process_pending_signals ();                     \
    } while (0)
  
  #else  /* not SYNC_INPUT */
*** trunk/src/blockinput.h.~1.28.~      2009-01-28 10:14:34.000000000 -0500
--- trunk/src/blockinput.h      2009-01-28 15:31:45.000000000 -0500
***************
*** 59,64 ****
--- 59,69 ----
  
  extern int pending_atimers;
  
+ /* This is equal to (interrupt_input_pending || pending_atimers).  */
+ 
+ extern int pending_signals;
+ 
+ 
  #if defined (HAVE_NS) && !defined (COCOA_EXPERIMENTAL_CTRL_G)
  /* NS does not use interrupt-driven input processing (yet), so this is
     unneeded and moreover was causing problems. */
*** trunk/src/keyboard.c.~1.991.~       2009-01-26 10:47:17.000000000 -0500
--- trunk/src/keyboard.c        2009-01-28 15:41:13.000000000 -0500
***************
*** 91,96 ****
--- 91,98 ----
     during the current critical section.  */
  int interrupt_input_pending;
  
+ int pending_signals;
+ 
  #define KBD_BUFFER_SIZE 4096
  
  KBOARD *initial_kboard;
***************
*** 2193,2203 ****
       struct atimer *timer;
  {
    if (poll_suppress_count == 0)
  #ifdef SYNC_INPUT
!     interrupt_input_pending = 1;
  #else
!     poll_for_input_1 ();
  #endif
  }
  
  #endif /* POLL_FOR_INPUT */
--- 2195,2208 ----
       struct atimer *timer;
  {
    if (poll_suppress_count == 0)
+     {
  #ifdef SYNC_INPUT
!       interrupt_input_pending = 1;
!       pending_signals = 1;
  #else
!       poll_for_input_1 ();
  #endif
+     }
  }
  
  #endif /* POLL_FOR_INPUT */
***************
*** 7261,7266 ****
--- 7266,7272 ----
  handle_async_input ()
  {
    interrupt_input_pending = 0;
+   pending_signals = pending_atimers;
  
    while (1)
      {
***************
*** 7274,7279 ****
--- 7280,7293 ----
      }
  }
  
+ void
+ process_pending_signals ()
+ {
+   if (interrupt_input_pending)
+     handle_async_input ();
+   do_pending_atimers ();
+ }
+ 
  #ifdef SIGIO   /* for entire page */
  /* Note SIGIO has been undef'd if FIONREAD is missing.  */
  
***************
*** 7291,7296 ****
--- 7305,7311 ----
  
  #ifdef SYNC_INPUT
    interrupt_input_pending = 1;
+   pending_signals = 1;
  #else
    SIGNAL_THREAD_CHECK (signo);
  #endif
***************
*** 11536,11541 ****
--- 11551,11557 ----
    input_pending = 0;
    interrupt_input_blocked = 0;
    interrupt_input_pending = 0;
+   pending_signals = pending_atimers;
  
    /* This means that command_loop_1 won't try to select anything the first
       time through.  */
*** trunk/src/atimer.c.~1.29.~  2009-01-08 06:46:21.000000000 -0500
--- trunk/src/atimer.c  2009-01-28 15:20:04.000000000 -0500
***************
*** 384,391 ****
        EMACS_GET_TIME (now);
      }
  
!   if (! pending_atimers)
!     set_alarm ();
  }
  
  
--- 384,396 ----
        EMACS_GET_TIME (now);
      }
  
!   if (pending_atimers)
!     pending_signals = 1;
!   else
!     {
!       pending_signals = interrupt_input_pending;
!       set_alarm ();
!     }
  }
  
  
***************
*** 397,402 ****
--- 402,408 ----
       int signo;
  {
    pending_atimers = 1;
+   pending_signals = 1;
  #ifndef SYNC_INPUT
    run_timers ();
  #endif
***************
*** 439,444 ****
--- 445,451 ----
  {
    free_atimers = atimers = NULL;
    pending_atimers = 0;
+   pending_signals = interrupt_input_pending;
    signal (SIGALRM, alarm_signal_handler);
  }
  
*** trunk/src/xterm.c.~1.1020.~ 2009-01-16 09:48:32.000000000 -0500
--- trunk/src/xterm.c   2009-01-28 15:23:48.000000000 -0500
***************
*** 7138,7147 ****
--- 7138,7149 ----
    if (interrupt_input_blocked)
      {
        interrupt_input_pending = 1;
+       pending_signals = 1;
        return -1;
      }
  
    interrupt_input_pending = 0;
+   pending_signals = pending_atimers;
    BLOCK_INPUT;
  
    /* So people can tell when we have read the available input.  */
*** trunk/src/w32inevt.c.~1.44.~        2009-01-08 06:46:26.000000000 -0500
--- trunk/src/w32inevt.c        2009-01-28 15:25:12.000000000 -0500
***************
*** 651,660 ****
--- 651,662 ----
    if (interrupt_input_blocked)
      {
        interrupt_input_pending = 1;
+       pending_signals = 1;
        return -1;
      }
  
    interrupt_input_pending = 0;
+   pending_signals = pending_atimers;
    BLOCK_INPUT;
  
    for (;;)
*** trunk/src/w32term.c.~1.317.~        2009-01-10 07:53:18.000000000 -0500
--- trunk/src/w32term.c 2009-01-28 15:24:50.000000000 -0500
***************
*** 4078,4087 ****
--- 4078,4089 ----
    if (interrupt_input_blocked)
      {
        interrupt_input_pending = 1;
+       pending_signals = 1;
        return -1;
      }
  
    interrupt_input_pending = 0;
+   pending_signals = pending_atimers;
    BLOCK_INPUT;
  
    /* So people can tell when we have read the available input.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]