* profiler.c (handle_profiler_signal): Inhibit pending signals too,
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 4 Oct 2012 05:52:49 +0000 (22:52 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 4 Oct 2012 05:52:49 +0000 (22:52 -0700)
to avoid similar races.
* keyboard.c (pending_signals): Now bool, not int.

src/ChangeLog
src/keyboard.c
src/lisp.h
src/profiler.c

index ced0e05..744376b 100644 (file)
@@ -1,3 +1,9 @@
+2012-10-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * profiler.c (handle_profiler_signal): Inhibit pending signals too,
+       to avoid similar races.
+       * keyboard.c (pending_signals): Now bool, not int.
+
 2012-10-02  Paul Eggert  <eggert@cs.ucla.edu>
 
        * profiler.c (handle_profiler_signal): Fix a malloc race
index 10dca01..19ece4a 100644 (file)
@@ -76,9 +76,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Positive if interrupt input is blocked right now.  */
 volatile int interrupt_input_blocked;
 
-/* Nonzero means an input interrupt or alarm signal has arrived.
+/* True means an input interrupt or alarm signal has arrived.
    The QUIT macro checks this.  */
-volatile int pending_signals;
+volatile bool pending_signals;
 
 #define KBD_BUFFER_SIZE 4096
 
index c3cabe0..2a647e5 100644 (file)
@@ -2131,7 +2131,7 @@ extern char *stack_bottom;
    a request to exit Emacs when it is safe to do.  */
 
 extern void process_pending_signals (void);
-extern int volatile pending_signals;
+extern bool volatile pending_signals;
 
 extern void process_quit_flag (void);
 #define QUIT                                           \
index 461aae3..5158071 100644 (file)
@@ -239,6 +239,7 @@ handle_profiler_signal (int signal)
   else
     {
       Lisp_Object oquit;
+      bool saved_pending_signals;
       EMACS_INT count = 1;
 #ifdef HAVE_ITIMERSPEC
       if (profiler_timer_ok)
@@ -252,12 +253,15 @@ handle_profiler_signal (int signal)
         uses QUIT, which can call malloc, which can cause disaster in
         a signal handler.  So inhibit QUIT.  */
       oquit = Vinhibit_quit;
+      saved_pending_signals = pending_signals;
       Vinhibit_quit = Qt;
+      pending_signals = 0;
 
       eassert (HASH_TABLE_P (cpu_log));
       record_backtrace (XHASH_TABLE (cpu_log), count);
 
       Vinhibit_quit = oquit;
+      pending_signals = saved_pending_signals;
     }
 }