| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 act.sa_sigaction = action; | 72 act.sa_sigaction = action; |
| 73 sigemptyset(&act.sa_mask); | 73 sigemptyset(&act.sa_mask); |
| 74 act.sa_flags = SA_RESTART | SA_SIGINFO; | 74 act.sa_flags = SA_RESTART | SA_SIGINFO; |
| 75 // TODO(johnmccutchan): Do we care about restoring the signal handler? | 75 // TODO(johnmccutchan): Do we care about restoring the signal handler? |
| 76 struct sigaction old_act; | 76 struct sigaction old_act; |
| 77 int r = sigaction(SIGPROF, &act, &old_act); | 77 int r = sigaction(SIGPROF, &act, &old_act); |
| 78 ASSERT(r == 0); | 78 ASSERT(r == 0); |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 ScopedSignalBlocker::ScopedSignalBlocker() { | |
| 83 sigset_t set; | |
| 84 sigemptyset(&set); | |
| 85 sigaddset(&set, SIGPROF); | |
| 86 pthread_sigmask(SIG_SETMASK, &set, &old_); | |
| 87 } | |
| 88 | |
| 89 | |
| 90 ScopedSignalBlocker::~ScopedSignalBlocker() { | |
| 91 pthread_sigmask(SIG_SETMASK, &old_, NULL); | |
| 92 } | |
| 93 | |
| 94 } // namespace dart | 82 } // namespace dart |
| 95 | 83 |
| 96 #endif // defined(TARGET_OS_MACOS) | 84 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |