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

Unified Diff: runtime/vm/thread_interrupter_win.cc

Issue 1439483003: - Add an OSThread structure which is the generic TLS structure for all C++ (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 5 years, 1 month 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
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();
+ 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)
-

Powered by Google App Engine
This is Rietveld 408576698