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

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 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
« no previous file with comments | « runtime/vm/thread_interrupter_macos.cc ('k') | runtime/vm/thread_pool.cc » ('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 4231d1e9d21d88b22997cc45813b4b39b7cb8046..ac613c151146611ab3c40d62988bb0e46c04d45d 100644
--- a/runtime/vm/thread_interrupter_win.cc
+++ b/runtime/vm/thread_interrupter_win.cc
@@ -52,19 +52,19 @@ class ThreadInterrupterWin : public AllStatic {
}
- static void Interrupt(Thread* thread) {
- ASSERT(!OSThread::Compare(GetCurrentThreadId(), thread->id()));
+ static void Interrupt(OSThread* os_thread) {
+ 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,19 +75,25 @@ 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;
}
- Profiler::SampleThread(thread, its);
+ // Currently we sample only threads that are associated
+ // with an isolate. It is safe to call 'os_thread->thread()'
+ // here as the thread which is being queried is suspended.
+ Thread* thread = os_thread->thread();
+ if (thread != NULL) {
+ Profiler::SampleThread(thread, its);
+ }
ResumeThread(handle);
CloseHandle(handle);
}
};
-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)
-
« no previous file with comments | « runtime/vm/thread_interrupter_macos.cc ('k') | runtime/vm/thread_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698