[Lldb-commits] [PATCH] D158035: [lldb] Protect RNBRemote from a data race

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 8 16:00:29 PDT 2023


jasonmolenda added inline comments.


================
Comment at: lldb/tools/debugserver/source/RNBRemote.cpp:780
 
   PThreadMutex::Locker locker(m_mutex);
   if (m_rx_packets.empty()) {
----------------
JDevlieghere wrote:
> This is an RAII object, right? Can we just block scope it? Right now it looks like we might not unlock if we return early on line 787. 
I agree with the suggested change.  But yeah I think putting the part of this method that touches m_rx_packets in a block, and holding the lock in that block, would be best, make it a little clearer.   As for the early return on 787, won't locker release the lock in its dtor?  


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158035/new/

https://reviews.llvm.org/D158035



More information about the lldb-commits mailing list