[Lldb-commits] [PATCH] D157760: [lldb] Properly protect the Communication class with reader/writer lock
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 14 10:30:05 PDT 2023
bulbazord added inline comments.
================
Comment at: lldb/include/lldb/Core/Communication.h:86-89
+ lldb_private::Connection *GetConnection() {
+ std::shared_lock guard(m_connection_mutex);
+ return m_connection_sp.get();
+ }
----------------
This isn't necessarily introduced by your patch, but I don't think this lock does much other than make sure nobody can change `m_connection_sp` in between you calling `GetConnection` and you actually receiving the `Connection` pointer. It still comes with all the pitfalls of handing out a raw pointer (instead of a `shared_ptr`).
As a follow-up or maybe even precursor, we should probably stop handing out the raw connection pointer...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157760/new/
https://reviews.llvm.org/D157760
More information about the lldb-commits
mailing list