OLD | NEW |
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_MACOS) | 8 #if defined(TARGET_OS_MACOS) |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return lr; | 103 return lr; |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 void SignalHandler::Install(SignalAction action) { | 107 void SignalHandler::Install(SignalAction action) { |
108 struct sigaction act; | 108 struct sigaction act; |
109 act.sa_handler = NULL; | 109 act.sa_handler = NULL; |
110 act.sa_sigaction = action; | 110 act.sa_sigaction = action; |
111 sigemptyset(&act.sa_mask); | 111 sigemptyset(&act.sa_mask); |
112 act.sa_flags = SA_RESTART | SA_SIGINFO; | 112 act.sa_flags = SA_RESTART | SA_SIGINFO; |
113 // TODO(johnmccutchan): Do we care about restoring the signal handler? | 113 int r = sigaction(SIGPROF, &act, NULL); |
114 struct sigaction old_act; | |
115 int r = sigaction(SIGPROF, &act, &old_act); | |
116 ASSERT(r == 0); | 114 ASSERT(r == 0); |
117 } | 115 } |
118 | 116 |
| 117 |
| 118 void SignalHandler::Remove() { |
| 119 // Ignore future SIGPROF signals because by default SIGPROF will terminate |
| 120 // the process and we may have some signals in flight. |
| 121 struct sigaction act; |
| 122 act.sa_handler = SIG_IGN; |
| 123 sigemptyset(&act.sa_mask); |
| 124 act.sa_flags = 0; |
| 125 int r = sigaction(SIGPROF, &act, NULL); |
| 126 ASSERT(r == 0); |
| 127 } |
| 128 |
119 | 129 |
120 } // namespace dart | 130 } // namespace dart |
121 | 131 |
122 #endif // defined(TARGET_OS_MACOS) | 132 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |