[Lldb-commits] [lldb] r266736 - Revert "LLDB: Fixed two race conditions when stopping private state thread"

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 19 07:03:44 PDT 2016


Author: labath
Date: Tue Apr 19 09:03:43 2016
New Revision: 266736

URL: http://llvm.org/viewvc/llvm-project?rev=266736&view=rev
Log:
Revert "LLDB: Fixed two race conditions when stopping private state thread"

This reverts commit r266733 as it causes a number of failures on linux buildbots.

Modified:
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=266736&r1=266735&r2=266736&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Tue Apr 19 09:03:43 2016
@@ -3310,10 +3310,7 @@ protected:
     bool
     PrivateStateThreadIsValid () const
     {
-        lldb::StateType state = m_private_state.GetValue();
-        return state != lldb::eStateDetached &&
-               state != lldb::eStateExited &&
-               m_private_state_thread.IsJoinable();
+        return m_private_state_thread.IsJoinable();
     }
     
     void

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=266736&r1=266735&r2=266736&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Apr 19 09:03:43 2016
@@ -4112,8 +4112,11 @@ Process::ControlPrivateStateThread (uint
     if (log)
         log->Printf ("Process::%s (signal = %d)", __FUNCTION__, signal);
 
-    // Signal the private state thread
-    if (PrivateStateThreadIsValid())
+    // Signal the private state thread. First we should copy this is case the
+    // thread starts exiting since the private state thread will NULL this out
+    // when it exits
+    HostThread private_state_thread(m_private_state_thread);
+    if (private_state_thread.IsJoinable())
     {
         TimeValue timeout_time;
         bool timed_out;
@@ -4131,7 +4134,7 @@ Process::ControlPrivateStateThread (uint
         {
             if (timed_out)
             {
-                Error error = m_private_state_thread.Cancel();
+                Error error = private_state_thread.Cancel();
                 if (log)
                     log->Printf ("Timed out responding to the control event, cancel got error: \"%s\".", error.AsCString());
             }
@@ -4142,7 +4145,7 @@ Process::ControlPrivateStateThread (uint
             }
 
             thread_result_t result = NULL;
-            m_private_state_thread.Join(&result);
+            private_state_thread.Join(&result);
             m_private_state_thread.Reset();
         }
     }
@@ -4446,6 +4449,7 @@ Process::RunPrivateStateThread (bool is_
     if (!is_secondary_thread)
         m_public_run_lock.SetStopped();
     m_private_state_control_wait.SetValue (true, eBroadcastAlways);
+    m_private_state_thread.Reset();
     return NULL;
 }
 




More information about the lldb-commits mailing list