From 704d3f455f837fd8881c72f82788a282ff093c82 Mon Sep 17 00:00:00 2001 From: Tomohiro Matsuyama Date: Fri, 28 Sep 2012 18:34:20 +0900 Subject: [PATCH] * profiler.c (sigprof_handler): Fix race condition. --- src/ChangeLog | 4 ++++ src/profiler.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 601c72a9fd3..d6a6d91b75a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-09-28 Tomohiro Matsuyama + + * profiler.c (sigprof_handler): Fix race condition. + 2012-09-28 Glenn Morris * lread.c (lisp_file_lexically_bound_p): Handle #! lines. (Bug#12528) diff --git a/src/profiler.c b/src/profiler.c index 877a42cc98e..4d748b547f5 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -24,6 +24,7 @@ along with GNU Emacs. If not, see . */ #include #include #include "lisp.h" +#include "syssignal.h" /* Logs. */ @@ -214,7 +215,7 @@ static int current_sample_interval; /* Signal handler for sample profiler. */ static void -sigprof_handler (int signal) +sigprof_handler_1 (int signal) { eassert (HASH_TABLE_P (cpu_log)); if (backtrace_list && EQ (*backtrace_list->function, Qautomatic_gc)) @@ -229,6 +230,12 @@ sigprof_handler (int signal) record_backtrace (XHASH_TABLE (cpu_log), current_sample_interval); } +static void +sigprof_handler (int signal) +{ + deliver_process_signal (signal, sigprof_handler_1); +} + DEFUN ("profiler-cpu-start", Fprofiler_cpu_start, Sprofiler_cpu_start, 1, 1, 0, doc: /* Start or restart the cpu profiler. -- 2.39.2