Chromium Code Reviews| 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; |
| } |
| } |