Index: runtime/vm/signal_handler_linux.cc |
diff --git a/runtime/vm/signal_handler_linux.cc b/runtime/vm/signal_handler_linux.cc |
index 957edda62bc2b5b46b0d0d7e4651f6898a51b554..960b417fc3717b1b2ee1196c8dabb763bf3214e5 100644 |
--- a/runtime/vm/signal_handler_linux.cc |
+++ b/runtime/vm/signal_handler_linux.cc |
@@ -129,9 +129,19 @@ void SignalHandler::Install(SignalAction action) { |
act.sa_sigaction = action; |
sigemptyset(&act.sa_mask); |
act.sa_flags = SA_RESTART | SA_SIGINFO; |
- // TODO(johnmccutchan): Do we care about restoring the signal handler? |
- struct sigaction old_act; |
- int r = sigaction(SIGPROF, &act, &old_act); |
+ int r = sigaction(SIGPROF, &act, NULL); |
+ ASSERT(r == 0); |
+} |
+ |
+ |
+void SignalHandler::Remove() { |
+ // Ignore future SIGPROF signals because by default SIGPROF will terminate |
+ // the process and we may have some signals in flight. |
+ struct sigaction act; |
+ act.sa_handler = SIG_IGN; |
+ sigemptyset(&act.sa_mask); |
+ act.sa_flags = 0; |
+ int r = sigaction(SIGPROF, &act, NULL); |
ASSERT(r == 0); |
} |