Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Unified Diff: src/platform-linux.cc

Issue 11195045: Pass the SIGPROF signal on to previously registered signal handler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-linux.cc
diff --git a/src/platform-linux.cc b/src/platform-linux.cc
index beb2ccee297fa062a8951fee7098a9f9b91a2de3..d3034a12dabec86f9a3c8c3342f50851f7da3536 100644
--- a/src/platform-linux.cc
+++ b/src/platform-linux.cc
@@ -77,6 +77,7 @@ namespace internal {
// name space and pid 0 is reserved (see man 2 kill).
static const pthread_t kNoThread = (pthread_t) 0;
+static void (*g_old_signal_handler)(int, siginfo_t *, void *) = NULL;
danno 2012/10/19 07:43:16 I don't think you need to store this separately. A
double ceiling(double x) {
return ceil(x);
@@ -1020,6 +1021,7 @@ static int GetThreadID() {
static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
USE(info);
if (signal != SIGPROF) return;
+ if (g_old_signal_handler) g_old_signal_handler(signal, info, context);
Isolate* isolate = Isolate::UncheckedCurrent();
if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) {
// We require a fully initialized and entered isolate.
@@ -1108,11 +1110,14 @@ class SignalSender : public Thread {
sa.sa_flags = SA_RESTART | SA_SIGINFO;
signal_handler_installed_ =
(sigaction(SIGPROF, &sa, &old_signal_handler_) == 0);
+ if (signal_handler_installed_)
+ g_old_signal_handler = old_signal_handler_.sa_sigaction;
}
static void RestoreSignalHandler() {
if (signal_handler_installed_) {
sigaction(SIGPROF, &old_signal_handler_, 0);
+ g_old_signal_handler = NULL;
signal_handler_installed_ = false;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698