Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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_H_ | 5 #ifndef VM_THREAD_H_ |
| 6 #define VM_THREAD_H_ | 6 #define VM_THREAD_H_ |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #include "vm/handles.h" | 9 #include "vm/handles.h" |
| 10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 StubCode::UpdateStoreBuffer_entry()->EntryPoint(), 0) \ | 84 StubCode::UpdateStoreBuffer_entry()->EntryPoint(), 0) \ |
| 85 V(uword, native_call_wrapper_entry_point_, \ | 85 V(uword, native_call_wrapper_entry_point_, \ |
| 86 NativeEntry::NativeCallWrapperEntry(), 0) \ | 86 NativeEntry::NativeCallWrapperEntry(), 0) \ |
| 87 V(RawString**, predefined_symbols_address_, \ | 87 V(RawString**, predefined_symbols_address_, \ |
| 88 Symbols::PredefinedAddress(), NULL) \ | 88 Symbols::PredefinedAddress(), NULL) \ |
| 89 | 89 |
| 90 #define CACHED_CONSTANTS_LIST(V) \ | 90 #define CACHED_CONSTANTS_LIST(V) \ |
| 91 CACHED_VM_OBJECTS_LIST(V) \ | 91 CACHED_VM_OBJECTS_LIST(V) \ |
| 92 CACHED_ADDRESSES_LIST(V) \ | 92 CACHED_ADDRESSES_LIST(V) \ |
| 93 | 93 |
| 94 struct InterruptedThreadState { | |
| 95 uintptr_t pc; | |
| 96 uintptr_t csp; | |
| 97 uintptr_t dsp; | |
| 98 uintptr_t fp; | |
| 99 uintptr_t lr; | |
| 100 }; | |
| 101 | |
| 102 // When a thread is interrupted the thread specific interrupt callback will be | |
| 103 // invoked. Each callback is given an InterruptedThreadState and the user data | |
| 104 // pointer. When inside a thread interrupt callback doing any of the following | |
| 105 // is forbidden: | |
| 106 // * Accessing TLS -- Because on Windows the callback will be running in a | |
| 107 // different thread. | |
| 108 // * Allocating memory -- Because this takes locks which may already be held, | |
| 109 // resulting in a dead lock. | |
| 110 // * Taking a lock -- See above. | |
| 111 typedef void (*ThreadInterruptCallback)(Thread* thread, | |
|
Cutch
2015/11/06 20:10:15
Please move the part of the comment about restrict
siva
2015/11/06 21:59:32
Done.
| |
| 112 const InterruptedThreadState& state); | |
| 113 | 94 |
| 114 // A VM thread; may be executing Dart code or performing helper tasks like | 95 // A VM thread; may be executing Dart code or performing helper tasks like |
| 115 // garbage collection or compilation. The Thread structure associated with | 96 // garbage collection or compilation. The Thread structure associated with |
| 116 // a thread is allocated by EnsureInit before entering an isolate, and destroyed | 97 // a thread is allocated by EnsureInit before entering an isolate, and destroyed |
| 117 // automatically when the underlying OS thread exits. NOTE: On Windows, CleanUp | 98 // automatically when the underlying OS thread exits. NOTE: On Windows, CleanUp |
| 118 // must currently be called manually (issue 23474). | 99 // must currently be called manually (issue 23474). |
| 119 class Thread { | 100 class Thread { |
| 120 public: | 101 public: |
| 121 // The currently executing thread, or NULL if not yet initialized. | 102 // The currently executing thread, or NULL if not yet initialized. |
| 122 static Thread* Current() { | 103 static Thread* Current() { |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 550 // Disable thread interrupts. | 531 // Disable thread interrupts. |
| 551 class DisableThreadInterruptsScope : public StackResource { | 532 class DisableThreadInterruptsScope : public StackResource { |
| 552 public: | 533 public: |
| 553 explicit DisableThreadInterruptsScope(Thread* thread); | 534 explicit DisableThreadInterruptsScope(Thread* thread); |
| 554 ~DisableThreadInterruptsScope(); | 535 ~DisableThreadInterruptsScope(); |
| 555 }; | 536 }; |
| 556 | 537 |
| 557 } // namespace dart | 538 } // namespace dart |
| 558 | 539 |
| 559 #endif // VM_THREAD_H_ | 540 #endif // VM_THREAD_H_ |
| OLD | NEW |