Chromium Code Reviews| Index: runtime/vm/thread_interrupter_win.cc |
| diff --git a/runtime/vm/thread_interrupter_win.cc b/runtime/vm/thread_interrupter_win.cc |
| index 4231d1e9d21d88b22997cc45813b4b39b7cb8046..a0de160c21686b9cd10d05ba5d3db02ce214934f 100644 |
| --- a/runtime/vm/thread_interrupter_win.cc |
| +++ b/runtime/vm/thread_interrupter_win.cc |
| @@ -52,19 +52,25 @@ class ThreadInterrupterWin : public AllStatic { |
| } |
| - static void Interrupt(Thread* thread) { |
| - ASSERT(!OSThread::Compare(GetCurrentThreadId(), thread->id())); |
| + static void Interrupt(OSThread* os_thread) { |
| + // Currently we sample only threads that are associated |
| + // with an isolate. |
| + Thread* thread = Thread::Current(); |
|
Cutch
2015/11/17 23:19:01
On Windows this is running on a different thread t
siva
2015/11/18 20:25:10
Addressed this as discussed offline.
|
| + if (thread == NULL) { |
| + return; |
| + } |
| + ASSERT(!OSThread::Compare(GetCurrentThreadId(), os_thread->id())); |
| HANDLE handle = OpenThread(THREAD_GET_CONTEXT | |
| THREAD_QUERY_INFORMATION | |
| THREAD_SUSPEND_RESUME, |
| false, |
| - thread->id()); |
| + os_thread->id()); |
| ASSERT(handle != NULL); |
| DWORD result = SuspendThread(handle); |
| if (result == kThreadError) { |
| if (FLAG_trace_thread_interrupter) { |
| OS::Print("ThreadInterrupter failed to suspend thread %p\n", |
| - reinterpret_cast<void*>(thread->id())); |
| + reinterpret_cast<void*>(os_thread->id())); |
| } |
| CloseHandle(handle); |
| return; |
| @@ -75,7 +81,7 @@ class ThreadInterrupterWin : public AllStatic { |
| ResumeThread(handle); |
| if (FLAG_trace_thread_interrupter) { |
| OS::Print("ThreadInterrupter failed to get registers for %p\n", |
| - reinterpret_cast<void*>(thread->id())); |
| + reinterpret_cast<void*>(os_thread->id())); |
| } |
| CloseHandle(handle); |
| return; |
| @@ -87,7 +93,7 @@ class ThreadInterrupterWin : public AllStatic { |
| }; |
| -void ThreadInterrupter::InterruptThread(Thread* thread) { |
| +void ThreadInterrupter::InterruptThread(OSThread* thread) { |
| if (FLAG_trace_thread_interrupter) { |
| OS::Print("ThreadInterrupter suspending %p\n", |
| reinterpret_cast<void*>(thread->id())); |
| @@ -113,4 +119,3 @@ void ThreadInterrupter::RemoveSignalHandler() { |
| } // namespace dart |
| #endif // defined(TARGET_OS_WINDOWS) |
| - |