summaryrefslogtreecommitdiff
path: root/src/profiler.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-10-02 12:38:10 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-10-02 12:38:10 -0700
commita3c5c0c5800ca55a2b0548d3d30a39f570b10e90 (patch)
treece2ff1ec87183735f4fb43aa3549f322e7d2ef5a /src/profiler.c
parent914e743b60af339ae577385a18685f8a40f9fe8f (diff)
downloademacs-a3c5c0c5800ca55a2b0548d3d30a39f570b10e90.tar.gz
* profiler.c (handle_profiler_signal): Fix a malloc race
that caused Emacs to hang on Fedora 17 when profiling Lisp.
Diffstat (limited to 'src/profiler.c')
-rw-r--r--src/profiler.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/profiler.c b/src/profiler.c
index 3282b8b335b..7b4ffc7f7bf 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -238,6 +238,7 @@ handle_profiler_signal (int signal)
cpu_gc_count = saturated_add (cpu_gc_count, 1);
else
{
+ Lisp_Object oquit;
EMACS_INT count = 1;
#ifdef HAVE_TIMER_SETTIME
if (profiler_timer_ok)
@@ -247,8 +248,16 @@ handle_profiler_signal (int signal)
count += overruns;
}
#endif
+ /* record_backtrace uses hash functions that call Fequal, which
+ uses QUIT, which can call malloc, which can cause disaster in
+ a signal handler. So inhibit QUIT. */
+ oquit = Vinhibit_quit;
+ Vinhibit_quit = Qt;
+
eassert (HASH_TABLE_P (cpu_log));
record_backtrace (XHASH_TABLE (cpu_log), count);
+
+ Vinhibit_quit = oquit;
}
}