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

Unified Diff: runtime/vm/thread_interrupter_win.cc

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/thread_interrupter_test.cc ('k') | runtime/vm/thread_registry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_interrupter_win.cc
diff --git a/runtime/vm/thread_interrupter_win.cc b/runtime/vm/thread_interrupter_win.cc
index 1bfd84f78bc501896064a641709e70d5fec0e0b6..70a5e8c93f877bc049eef271a4c32bae48bdf558 100644
--- a/runtime/vm/thread_interrupter_win.cc
+++ b/runtime/vm/thread_interrupter_win.cc
@@ -51,57 +51,55 @@ class ThreadInterrupterWin : public AllStatic {
}
- static void Interrupt(InterruptableThreadState* state) {
- ASSERT(!OSThread::Compare(GetCurrentThreadId(), state->id));
+ static void Interrupt(Thread* thread) {
+ ASSERT(!OSThread::Compare(GetCurrentThreadId(), thread->id()));
HANDLE handle = OpenThread(THREAD_GET_CONTEXT |
THREAD_QUERY_INFORMATION |
THREAD_SUSPEND_RESUME,
false,
- state->id);
+ thread->id());
ASSERT(handle != NULL);
DWORD result = SuspendThread(handle);
if (result == kThreadError) {
if (FLAG_trace_thread_interrupter) {
- OS::Print("ThreadInterrupted failed to suspend thread %p\n",
- reinterpret_cast<void*>(state->id));
+ OS::Print("ThreadInterrupter failed to suspend thread %p\n",
+ reinterpret_cast<void*>(thread->id()));
}
CloseHandle(handle);
return;
}
InterruptedThreadState its;
- its.tid = state->id;
+ its.tid = thread->id();
if (!GrabRegisters(handle, &its)) {
// Failed to get thread registers.
ResumeThread(handle);
if (FLAG_trace_thread_interrupter) {
- OS::Print("ThreadInterrupted failed to get registers for %p\n",
- reinterpret_cast<void*>(state->id));
+ OS::Print("ThreadInterrupter failed to get registers for %p\n",
+ reinterpret_cast<void*>(thread->id()));
}
CloseHandle(handle);
return;
}
- if (state->callback == NULL) {
- // No callback registered.
- ResumeThread(handle);
- CloseHandle(handle);
- return;
+ ThreadInterruptCallback callback = NULL;
+ void* callback_data = NULL;
+ if (thread->IsThreadInterrupterEnabled(&callback, &callback_data)) {
+ callback(its, callback_data);
}
- state->callback(its, state->data);
ResumeThread(handle);
CloseHandle(handle);
}
};
-void ThreadInterrupter::InterruptThread(InterruptableThreadState* state) {
+void ThreadInterrupter::InterruptThread(Thread* thread) {
if (FLAG_trace_thread_interrupter) {
OS::Print("ThreadInterrupter suspending %p\n",
- reinterpret_cast<void*>(state->id));
+ reinterpret_cast<void*>(thread->id()));
}
- ThreadInterrupterWin::Interrupt(state);
+ ThreadInterrupterWin::Interrupt(thread);
if (FLAG_trace_thread_interrupter) {
OS::Print("ThreadInterrupter resuming %p\n",
- reinterpret_cast<void*>(state->id));
+ reinterpret_cast<void*>(thread->id()));
}
}
« no previous file with comments | « runtime/vm/thread_interrupter_test.cc ('k') | runtime/vm/thread_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698