| 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 #ifndef VM_THREAD_INTERRUPTER_H_ | 5 #ifndef VM_THREAD_INTERRUPTER_H_ |
| 6 #define VM_THREAD_INTERRUPTER_H_ | 6 #define VM_THREAD_INTERRUPTER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/signal_handler.h" | 9 #include "vm/signal_handler.h" |
| 10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
| 11 | 11 |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 struct InterruptedThreadState { | 15 struct InterruptedThreadState { |
| 16 ThreadId tid; | 16 ThreadId tid; |
| 17 uintptr_t pc; | 17 uintptr_t pc; |
| 18 uintptr_t csp; | 18 uintptr_t csp; |
| 19 uintptr_t dsp; | 19 uintptr_t dsp; |
| 20 uintptr_t fp; | 20 uintptr_t fp; |
| 21 uintptr_t lr; |
| 21 }; | 22 }; |
| 22 | 23 |
| 23 // When a thread is interrupted the thread specific interrupt callback will be | 24 // When a thread is interrupted the thread specific interrupt callback will be |
| 24 // invoked. Each callback is given an InterruptedThreadState and the user data | 25 // invoked. Each callback is given an InterruptedThreadState and the user data |
| 25 // pointer. When inside a thread interrupt callback doing any of the following | 26 // pointer. When inside a thread interrupt callback doing any of the following |
| 26 // is forbidden: | 27 // is forbidden: |
| 27 // * Accessing TLS. | 28 // * Accessing TLS. |
| 28 // * Allocating memory. | 29 // * Allocating memory. |
| 29 // * Taking a lock. | 30 // * Taking a lock. |
| 30 typedef void (*ThreadInterruptCallback)(const InterruptedThreadState& state, | 31 typedef void (*ThreadInterruptCallback)(const InterruptedThreadState& state, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 static void InstallSignalHandler(); | 93 static void InstallSignalHandler(); |
| 93 | 94 |
| 94 friend class ThreadInterrupterVisitIsolates; | 95 friend class ThreadInterrupterVisitIsolates; |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data); | 98 void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data); |
| 98 | 99 |
| 99 } // namespace dart | 100 } // namespace dart |
| 100 | 101 |
| 101 #endif // VM_THREAD_INTERRUPTER_H_ | 102 #endif // VM_THREAD_INTERRUPTER_H_ |
| OLD | NEW |