Index: runtime/vm/thread_interrupter.cc |
diff --git a/runtime/vm/thread_interrupter.cc b/runtime/vm/thread_interrupter.cc |
index 0ad9ead78a78515ad8db21d12bffd6bca09eacf7..0372f68bcf3b44b79e4ef72a21d4e72ff27eda5a 100644 |
--- a/runtime/vm/thread_interrupter.cc |
+++ b/runtime/vm/thread_interrupter.cc |
@@ -70,8 +70,17 @@ void ThreadInterrupter::InitOnce() { |
void ThreadInterrupter::Startup() { |
ASSERT(initialized_); |
+ if (IsDebuggerAttached()) { |
+ MonitorLocker shutdown_ml(monitor_); |
+ shutdown_ = true; |
+ if (FLAG_trace_thread_interrupter) { |
+ OS::PrintErr( |
+ "ThreadInterrupter disabled because a debugger is attached.\n"); |
+ } |
+ return; |
+ } |
if (FLAG_trace_thread_interrupter) { |
- OS::Print("ThreadInterrupter starting up.\n"); |
+ OS::PrintErr("ThreadInterrupter starting up.\n"); |
} |
ASSERT(interrupter_thread_id_ == OSThread::kInvalidThreadJoinId); |
{ |
@@ -83,7 +92,7 @@ void ThreadInterrupter::Startup() { |
} |
ASSERT(interrupter_thread_id_ != OSThread::kInvalidThreadJoinId); |
if (FLAG_trace_thread_interrupter) { |
- OS::Print("ThreadInterrupter running.\n"); |
+ OS::PrintErr("ThreadInterrupter running.\n"); |
} |
} |
@@ -100,7 +109,7 @@ void ThreadInterrupter::Shutdown() { |
shutdown_ml.Notify(); |
ASSERT(initialized_); |
if (FLAG_trace_thread_interrupter) { |
- OS::Print("ThreadInterrupter shutting down.\n"); |
+ OS::PrintErr("ThreadInterrupter shutting down.\n"); |
} |
} |
@@ -110,7 +119,7 @@ void ThreadInterrupter::Shutdown() { |
interrupter_thread_id_ = OSThread::kInvalidThreadJoinId; |
if (FLAG_trace_thread_interrupter) { |
- OS::Print("ThreadInterrupter shut down.\n"); |
+ OS::PrintErr("ThreadInterrupter shut down.\n"); |
} |
} |
@@ -149,7 +158,7 @@ void ThreadInterrupter::ThreadMain(uword parameters) { |
ASSERT(initialized_); |
InstallSignalHandler(); |
if (FLAG_trace_thread_interrupter) { |
- OS::Print("ThreadInterrupter thread running.\n"); |
+ OS::PrintErr("ThreadInterrupter thread running.\n"); |
} |
{ |
// Signal to main thread we are ready. |
@@ -215,7 +224,7 @@ void ThreadInterrupter::ThreadMain(uword parameters) { |
} |
RemoveSignalHandler(); |
if (FLAG_trace_thread_interrupter) { |
- OS::Print("ThreadInterrupter thread exiting.\n"); |
+ OS::PrintErr("ThreadInterrupter thread exiting.\n"); |
} |
{ |
// Signal to main thread we are exiting. |