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

Unified Diff: runtime/vm/signal_handler_android.cc

Issue 1061033005: Remove profiler signal handler on shutdown (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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
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

Powered by Google App Engine
This is Rietveld 408576698