[Lldb-commits] [PATCH] D83359: [Function] Lock the function when parsing call site info

Vedant Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 9 10:29:38 PDT 2020


vsk added inline comments.


================
Comment at: lldb/include/lldb/Symbol/Function.h:661
+  std::mutex
+      m_call_edges_lock; ///< Exclusive lock that controls read/write
+                         ///  access to m_call_edges and m_call_edges_resolved.
----------------
aprantl wrote:
> nit: When inline comments span multiple lines it's IMO less confusing to convert them to up-front comments.
> ```
>   /// Exclusive lock that controls read/write
>   /// access to m_call_edges and m_call_edges_resolved.
>   std::mutex m_call_edges_lock;
> ```
> 
> I also doubt that the ones in this file are formatted correctly, I think the continuation needs to also use `///<`.
Sounds good. I'll reformat all of the data member doxygen comments in this file in a follow up.


================
Comment at: lldb/source/Symbol/Function.cpp:293
 llvm::ArrayRef<std::unique_ptr<CallEdge>> Function::GetCallEdges() {
+  std::lock_guard<std::mutex> guard(m_call_edges_lock);
+
----------------
aprantl wrote:
> Can this be called on the same thread and would we benefit from a recursive_mutex?
Function::GetCallEdges() cannot recursively call itself, so a recursive_mutex isn't necessary. Actually if the mutex were taken recursively, that would allow the m_call_edges vector to be clobbered by the n-1 GetCallEdges callers who took the lock before the n-th caller.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83359





More information about the lldb-commits mailing list