Adding support for setting thread stop state when a process stops.
This re-submission of this patch fixes a problem where the code sometimes caused a deadlock. The Process::SetPrivateState method was locking the Process::m_private_state variable and then later calling ThreadList::DidStop, which locks the ThreadList mutex. Other methods in ThreadList which were being called from other threads lock the ThreadList mutex and then call Process::GetPrivateState which locks the Process::m_private_state mutex. To avoid deadlocks, Process::SetPrivateState now locks the ThreadList mutex before locking the Process::m_private_state mutex.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181609 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Thread.cpp b/source/Target/Thread.cpp
index 646a635..c4aa254 100644
--- a/source/Target/Thread.cpp
+++ b/source/Target/Thread.cpp
@@ -658,6 +658,12 @@
SetResumeSignal (LLDB_INVALID_SIGNAL_NUMBER);
}
+void
+Thread::DidStop ()
+{
+ SetState (eStateStopped);
+}
+
bool
Thread::ShouldStop (Event* event_ptr)
{