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