[Lldb-commits] [PATCH] D19122: LLDB: Fixed race condition on timeout when stopping private state thread

Cameron via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 14 16:46:46 PDT 2016


cameron314 added a comment.

Ooh, that might work. But when ControlProvateStateThread resets m_private_state_control_wait to false there's still a race between that and the thread exiting. It could then be set back to false even after the thread has exited (this is even likely for a detach).

I tried a different approach, changing `PrivateStateThreadIsValid` to the following. I'm not sure it's the right thing to do, but it certainly fixes the race (and thus timeout) on our platform:

  bool
  PrivateStateThreadIsValid () const
  {
      lldb::StateType state = m_private_state.GetValue();
      return state != lldb::eStateDetached &&
             state != lldb::eStateExited &&
             m_private_state_thread.IsJoinable();
  }


Repository:
  rL LLVM

http://reviews.llvm.org/D19122





More information about the lldb-commits mailing list