From 6145366510197e52862236960816c14b6e687004 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 19 Apr 2016 14:03:43 +0000 Subject: [PATCH] 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. llvm-svn: 266736 --- lldb/include/lldb/Target/Process.h | 5 +---- lldb/source/Target/Process.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 8feca35..fd483f0 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -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 diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index d15d1416..6a9328f 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -4112,8 +4112,11 @@ Process::ControlPrivateStateThread (uint32_t signal) 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 (uint32_t signal) { 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 (uint32_t signal) } 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_secondary_thread) if (!is_secondary_thread) m_public_run_lock.SetStopped(); m_private_state_control_wait.SetValue (true, eBroadcastAlways); + m_private_state_thread.Reset(); return NULL; } -- 2.7.4