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_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
7 | 7 |
8 #include <sys/syscall.h> // NOLINT | 8 #include <sys/syscall.h> // NOLINT |
9 #include <errno.h> // NOLINT | 9 #include <errno.h> // NOLINT |
10 | 10 |
11 #include "vm/flags.h" | 11 #include "vm/flags.h" |
12 #include "vm/os.h" | 12 #include "vm/os.h" |
13 #include "vm/profiler.h" | 13 #include "vm/profiler.h" |
14 #include "vm/signal_handler.h" | 14 #include "vm/signal_handler.h" |
15 #include "vm/thread_interrupter.h" | 15 #include "vm/thread_interrupter.h" |
16 | 16 |
17 namespace dart { | 17 namespace dart { |
18 | 18 |
19 #ifndef PRODUCT | 19 #ifndef PRODUCT |
20 | 20 |
21 DECLARE_FLAG(bool, thread_interrupter); | 21 DECLARE_FLAG(bool, thread_interrupter); |
22 DECLARE_FLAG(bool, trace_thread_interrupter); | 22 DECLARE_FLAG(bool, trace_thread_interrupter); |
23 | 23 |
24 class ThreadInterrupterAndroid : public AllStatic { | 24 class ThreadInterrupterAndroid : public AllStatic { |
25 public: | 25 public: |
26 static void ThreadInterruptSignalHandler(int signal, siginfo_t* info, | 26 static void ThreadInterruptSignalHandler(int signal, |
| 27 siginfo_t* info, |
27 void* context_) { | 28 void* context_) { |
28 if (signal != SIGPROF) { | 29 if (signal != SIGPROF) { |
29 return; | 30 return; |
30 } | 31 } |
31 Thread* thread = Thread::Current(); | 32 Thread* thread = Thread::Current(); |
32 if (thread == NULL) { | 33 if (thread == NULL) { |
33 return; | 34 return; |
34 } | 35 } |
35 // Extract thread state. | 36 // Extract thread state. |
36 ucontext_t* context = reinterpret_cast<ucontext_t*>(context_); | 37 ucontext_t* context = reinterpret_cast<ucontext_t*>(context_); |
(...skipping 27 matching lines...) Expand all Loading... |
64 | 65 |
65 void ThreadInterrupter::RemoveSignalHandler() { | 66 void ThreadInterrupter::RemoveSignalHandler() { |
66 SignalHandler::Remove(); | 67 SignalHandler::Remove(); |
67 } | 68 } |
68 | 69 |
69 #endif // !PRODUCT | 70 #endif // !PRODUCT |
70 | 71 |
71 } // namespace dart | 72 } // namespace dart |
72 | 73 |
73 #endif // defined(TARGET_OS_ANDROID) | 74 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |