Index: runtime/vm/signal_handler_android.cc |
diff --git a/runtime/vm/signal_handler_android.cc b/runtime/vm/signal_handler_android.cc |
index d8ea14e0ae803ef8d3525fb2f6347d52b488794e..1ac0b8c606173942f36898b2a3d8efe808093356 100644 |
--- a/runtime/vm/signal_handler_android.cc |
+++ b/runtime/vm/signal_handler_android.cc |
@@ -84,11 +84,21 @@ void SignalHandler::Install(SignalAction action) { |
struct sigaction act; |
memset(&act, 0, sizeof(act)); |
act.sa_sigaction = action; |
+ sigemptyset(&act.sa_mask); |
act.sa_flags = SA_RESTART | SA_SIGINFO; |
+ 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; |
+ memset(&act, 0, sizeof(act)); |
+ act.sa_handler = SIG_IGN; |
sigemptyset(&act.sa_mask); |
- // 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); |
} |
siva
2015/04/07 18:18:07
The normal protocol is to remember the old action
Cutch
2015/04/07 18:35:55
The default SIGPROF handler terminates the process
|