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

Side by Side Diff: runtime/vm/signal_handler_linux.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #include "vm/simulator.h" 6 #include "vm/simulator.h"
7 #include "vm/signal_handler.h" 7 #include "vm/signal_handler.h"
8 #if defined(TARGET_OS_LINUX) 8 #if defined(TARGET_OS_LINUX)
9 9
10 namespace dart { 10 namespace dart {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 return lr; 122 return lr;
123 } 123 }
124 124
125 125
126 void SignalHandler::Install(SignalAction action) { 126 void SignalHandler::Install(SignalAction action) {
127 struct sigaction act; 127 struct sigaction act;
128 act.sa_handler = NULL; 128 act.sa_handler = NULL;
129 act.sa_sigaction = action; 129 act.sa_sigaction = action;
130 sigemptyset(&act.sa_mask); 130 sigemptyset(&act.sa_mask);
131 act.sa_flags = SA_RESTART | SA_SIGINFO; 131 act.sa_flags = SA_RESTART | SA_SIGINFO;
132 // TODO(johnmccutchan): Do we care about restoring the signal handler? 132 int r = sigaction(SIGPROF, &act, NULL);
133 struct sigaction old_act;
134 int r = sigaction(SIGPROF, &act, &old_act);
135 ASSERT(r == 0); 133 ASSERT(r == 0);
136 } 134 }
137 135
136
137 void SignalHandler::Remove() {
138 // Ignore future SIGPROF signals because by default SIGPROF will terminate
139 // the process and we may have some signals in flight.
140 struct sigaction act;
141 act.sa_handler = SIG_IGN;
142 sigemptyset(&act.sa_mask);
143 act.sa_flags = 0;
144 int r = sigaction(SIGPROF, &act, NULL);
145 ASSERT(r == 0);
146 }
147
138 148
139 } // namespace dart 149 } // namespace dart
140 150
141 #endif // defined(TARGET_OS_LINUX) 151 #endif // defined(TARGET_OS_LINUX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698