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(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
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 | 18 #ifndef PRODUCT |
19 | 19 |
20 DECLARE_FLAG(bool, thread_interrupter); | 20 DECLARE_FLAG(bool, thread_interrupter); |
21 DECLARE_FLAG(bool, trace_thread_interrupter); | 21 DECLARE_FLAG(bool, trace_thread_interrupter); |
22 | 22 |
23 class ThreadInterrupterMacOS : public AllStatic { | 23 class ThreadInterrupterMacOS : public AllStatic { |
24 public: | 24 public: |
25 static void ThreadInterruptSignalHandler(int signal, siginfo_t* info, | 25 static void ThreadInterruptSignalHandler(int signal, |
| 26 siginfo_t* info, |
26 void* context_) { | 27 void* context_) { |
27 if (signal != SIGPROF) { | 28 if (signal != SIGPROF) { |
28 return; | 29 return; |
29 } | 30 } |
30 Thread* thread = Thread::Current(); | 31 Thread* thread = Thread::Current(); |
31 if (thread == NULL) { | 32 if (thread == NULL) { |
32 return; | 33 return; |
33 } | 34 } |
34 // Extract thread state. | 35 // Extract thread state. |
35 ucontext_t* context = reinterpret_cast<ucontext_t*>(context_); | 36 ucontext_t* context = reinterpret_cast<ucontext_t*>(context_); |
(...skipping 26 matching lines...) Expand all Loading... |
62 | 63 |
63 void ThreadInterrupter::RemoveSignalHandler() { | 64 void ThreadInterrupter::RemoveSignalHandler() { |
64 SignalHandler::Remove(); | 65 SignalHandler::Remove(); |
65 } | 66 } |
66 | 67 |
67 #endif // !PRODUCT | 68 #endif // !PRODUCT |
68 | 69 |
69 } // namespace dart | 70 } // namespace dart |
70 | 71 |
71 #endif // defined(TARGET_OS_MACOS) | 72 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |