| 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 "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(HOST_OS_LINUX) | 6 #if defined(HOST_OS_LINUX) |
| 7 | 7 |
| 8 #include <errno.h> // NOLINT | 8 #include <errno.h> // NOLINT |
| 9 | 9 |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| 11 #include "vm/os.h" | 11 #include "vm/os.h" |
| 12 #include "vm/profiler.h" | 12 #include "vm/profiler.h" |
| 13 #include "vm/signal_handler.h" | 13 #include "vm/signal_handler.h" |
| 14 #include "vm/thread_interrupter.h" | 14 #include "vm/thread_interrupter.h" |
| 15 | 15 |
| 16 namespace dart { | 16 namespace dart { |
| 17 | 17 |
| 18 #ifndef PRODUCT |
| 19 |
| 18 DECLARE_FLAG(bool, thread_interrupter); | 20 DECLARE_FLAG(bool, thread_interrupter); |
| 19 DECLARE_FLAG(bool, trace_thread_interrupter); | 21 DECLARE_FLAG(bool, trace_thread_interrupter); |
| 20 | 22 |
| 21 class ThreadInterrupterLinux : public AllStatic { | 23 class ThreadInterrupterLinux : public AllStatic { |
| 22 public: | 24 public: |
| 23 static void ThreadInterruptSignalHandler(int signal, | 25 static void ThreadInterruptSignalHandler(int signal, |
| 24 siginfo_t* info, | 26 siginfo_t* info, |
| 25 void* context_) { | 27 void* context_) { |
| 26 if (signal != SIGPROF) { | 28 if (signal != SIGPROF) { |
| 27 return; | 29 return; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void ThreadInterrupter::InstallSignalHandler() { | 64 void ThreadInterrupter::InstallSignalHandler() { |
| 63 SignalHandler::Install< | 65 SignalHandler::Install< |
| 64 ThreadInterrupterLinux::ThreadInterruptSignalHandler>(); | 66 ThreadInterrupterLinux::ThreadInterruptSignalHandler>(); |
| 65 } | 67 } |
| 66 | 68 |
| 67 | 69 |
| 68 void ThreadInterrupter::RemoveSignalHandler() { | 70 void ThreadInterrupter::RemoveSignalHandler() { |
| 69 SignalHandler::Remove(); | 71 SignalHandler::Remove(); |
| 70 } | 72 } |
| 71 | 73 |
| 74 #endif // !PRODUCT |
| 72 | 75 |
| 73 } // namespace dart | 76 } // namespace dart |
| 74 | 77 |
| 75 #endif // defined(HOST_OS_LINUX) | 78 #endif // defined(HOST_OS_LINUX) |
| OLD | NEW |