forked from OSchip/llvm-project
Clear up any deadlocks on Apple builds that were due to the lldb_private::Process.m_private_run_lock variable.
If someone on Linux and/or FreeBSD can try to comment out the " #if defined(__APPLE__)" that surrounds access to "m_private_run_lock" and run the test suite, that would be nice. The new location where the locking/unlocking happens is bulletproof on MacOSX, and I want to verify that it is good on linux as well. llvm-svn: 181061
This commit is contained in:
parent
e575be4c0e
commit
aa49c83cd9
|
|
@ -1161,8 +1161,10 @@ Process::Finalize()
|
||||||
// contain events that have ProcessSP values in them which can keep this
|
// contain events that have ProcessSP values in them which can keep this
|
||||||
// process around forever. These events need to be cleared out.
|
// process around forever. These events need to be cleared out.
|
||||||
m_private_state_listener.Clear();
|
m_private_state_listener.Clear();
|
||||||
|
m_public_run_lock.WriteTryLock(); // This will do nothing if already locked
|
||||||
m_public_run_lock.WriteUnlock();
|
m_public_run_lock.WriteUnlock();
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
m_private_run_lock.WriteTryLock(); // This will do nothing if already locked
|
||||||
m_private_run_lock.WriteUnlock();
|
m_private_run_lock.WriteUnlock();
|
||||||
#endif
|
#endif
|
||||||
m_finalize_called = true;
|
m_finalize_called = true;
|
||||||
|
|
@ -1704,16 +1706,18 @@ Process::SetPrivateState (StateType new_state)
|
||||||
// the private process state with another run lock. Right now it doesn't
|
// the private process state with another run lock. Right now it doesn't
|
||||||
// seem like we need to do this, but if we ever do, we can uncomment and
|
// seem like we need to do this, but if we ever do, we can uncomment and
|
||||||
// use this code.
|
// use this code.
|
||||||
// const bool old_state_is_stopped = StateIsStoppedState(old_state, false);
|
#if defined(__APPLE__)
|
||||||
// const bool new_state_is_stopped = StateIsStoppedState(new_state, false);
|
const bool old_state_is_stopped = StateIsStoppedState(old_state, false);
|
||||||
// if (old_state_is_stopped != new_state_is_stopped)
|
const bool new_state_is_stopped = StateIsStoppedState(new_state, false);
|
||||||
// {
|
if (old_state_is_stopped != new_state_is_stopped)
|
||||||
// if (new_state_is_stopped)
|
{
|
||||||
// m_private_run_lock.WriteUnlock();
|
if (new_state_is_stopped)
|
||||||
// else
|
m_private_run_lock.WriteUnlock();
|
||||||
// m_private_run_lock.WriteLock();
|
else
|
||||||
// }
|
m_private_run_lock.WriteLock();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (state_changed)
|
if (state_changed)
|
||||||
{
|
{
|
||||||
m_private_state.SetValueNoLock (new_state);
|
m_private_state.SetValueNoLock (new_state);
|
||||||
|
|
@ -3282,9 +3286,6 @@ Process::PrivateResume ()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_mod_id.BumpResumeID();
|
m_mod_id.BumpResumeID();
|
||||||
#if defined(__APPLE__)
|
|
||||||
m_private_run_lock.WriteLock();
|
|
||||||
#endif
|
|
||||||
error = DoResume();
|
error = DoResume();
|
||||||
if (error.Success())
|
if (error.Success())
|
||||||
{
|
{
|
||||||
|
|
@ -3293,12 +3294,6 @@ Process::PrivateResume ()
|
||||||
if (log)
|
if (log)
|
||||||
log->Printf ("Process thinks the process has resumed.");
|
log->Printf ("Process thinks the process has resumed.");
|
||||||
}
|
}
|
||||||
#if defined(__APPLE__)
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_private_run_lock.WriteUnlock();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -3670,10 +3665,6 @@ Process::ShouldBroadcastEvent (Event *event_ptr)
|
||||||
// If we are going to stop, then we always broadcast the event.
|
// If we are going to stop, then we always broadcast the event.
|
||||||
// If we aren't going to stop, let the thread plans decide if we're going to report this event.
|
// If we aren't going to stop, let the thread plans decide if we're going to report this event.
|
||||||
// If no thread has an opinion, we don't report it.
|
// If no thread has an opinion, we don't report it.
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
m_private_run_lock.WriteUnlock();
|
|
||||||
#endif
|
|
||||||
RefreshStateAfterStop ();
|
RefreshStateAfterStop ();
|
||||||
if (ProcessEventData::GetInterruptedFromEvent (event_ptr))
|
if (ProcessEventData::GetInterruptedFromEvent (event_ptr))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue