Index: runtime/vm/thread.h |
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h |
index c5f095c3a62300880d273c314d542bd036c4958e..5f2b13e783fe8e0efab6464cfba9a9b0cf34a687 100644 |
--- a/runtime/vm/thread.h |
+++ b/runtime/vm/thread.h |
@@ -92,7 +92,6 @@ class Zone; |
CACHED_ADDRESSES_LIST(V) \ |
struct InterruptedThreadState { |
- ThreadId tid; |
uintptr_t pc; |
uintptr_t csp; |
uintptr_t dsp; |
@@ -109,8 +108,8 @@ struct InterruptedThreadState { |
// * Allocating memory -- Because this takes locks which may already be held, |
// resulting in a dead lock. |
// * Taking a lock -- See above. |
-typedef void (*ThreadInterruptCallback)(const InterruptedThreadState& state, |
- void* data); |
+typedef void (*ThreadInterruptCallback)(Thread* thread, |
+ const InterruptedThreadState& state); |
// A VM thread; may be executing Dart code or performing helper tasks like |
// garbage collection or compilation. The Thread structure associated with |
@@ -163,6 +162,12 @@ class Thread { |
} |
bool IsMutatorThread() const; |
+ // Is |this| executing Dart code? |
+ bool IsExecutingDartCode() const; |
+ |
+ // Has |this| exited Dart code? |
+ bool HasExitedDartCode() const; |
+ |
// The (topmost) CHA for the compilation in this thread. |
CHA* cha() const; |
void set_cha(CHA* value); |
@@ -377,10 +382,15 @@ LEAF_RUNTIME_ENTRY_LIST(DEFINE_OFFSET_METHOD) |
return join_id_; |
} |
- void SetThreadInterrupter(ThreadInterruptCallback callback, void* data); |
+ // Used to temporarily disable or enable thread interrupts. |
+ void DisableThreadInterrupts(); |
+ void EnableThreadInterrupts(); |
+ bool ThreadInterruptsEnabled(); |
+ |
+ void SetThreadInterruptCallback(ThreadInterruptCallback callback); |
- bool IsThreadInterrupterEnabled(ThreadInterruptCallback* callback, |
- void** data) const; |
+ // Returns true if *callback != null. |
+ bool GetThreadInterruptCallback(ThreadInterruptCallback* callback) const; |
#if defined(DEBUG) |
#define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \ |
@@ -425,7 +435,7 @@ LEAF_RUNTIME_ENTRY_LIST(DEFINE_OFFSET_METHOD) |
const ThreadId id_; |
const ThreadId join_id_; |
ThreadInterruptCallback thread_interrupt_callback_; |
- void* thread_interrupt_data_; |
+ uintptr_t thread_interrupt_disabled_; |
Isolate* isolate_; |
Heap* heap_; |
State state_; |