Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(972)

Unified Diff: runtime/vm/thread.h

Issue 1293253005: Completely remove InterruptableThreadState and Fix ThreadRegistry leak (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.h
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index 44b804013e7b6ec3c85ff4c0d8ef290d7ac88ca5..ccf7435f75252605e9366357b5c2969b0c9e32ca 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -39,6 +39,26 @@ class Zone;
CACHED_VM_OBJECTS_LIST(V) \
CACHED_ADDRESSES_LIST(V)
+struct InterruptedThreadState {
+ ThreadId tid;
+ uintptr_t pc;
+ uintptr_t csp;
+ uintptr_t dsp;
+ uintptr_t fp;
+ uintptr_t lr;
+};
+
+// When a thread is interrupted the thread specific interrupt callback will be
+// invoked. Each callback is given an InterruptedThreadState and the user data
+// pointer. When inside a thread interrupt callback doing any of the following
+// is forbidden:
+// * Accessing TLS -- Because on Windows the callback will be running in a
+// different thread.
+// * 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);
// A VM thread; may be executing Dart code or performing helper tasks like
// garbage collection or compilation. The Thread structure associated with
@@ -233,9 +253,22 @@ CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD)
state_.long_jump_base = value;
}
+ ThreadId id() const {
+ ASSERT(id_ != OSThread::kInvalidThreadId);
+ return id_;
+ }
+
+ void SetThreadInterrupter(ThreadInterruptCallback callback, void* data);
+
+ bool IsThreadInterrupterEnabled(ThreadInterruptCallback* callback,
+ void** data) const;
+
private:
static ThreadLocalKey thread_key_;
+ const ThreadId id_;
+ ThreadInterruptCallback thread_interrupt_callback_;
+ void* thread_interrupt_data_;
Isolate* isolate_;
Heap* heap_;
State state_;
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698