[Lldb-commits] [PATCH] D133410: [lldb] Fix ThreadedCommunication races

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 7 06:50:24 PDT 2022


mgorny accepted this revision.
mgorny added a comment.
This revision is now accepted and ready to land.

Thanks for noticing and fixing this.



================
Comment at: lldb/source/Core/ThreadedCommunication.cpp:113
 
-      if (event_type & eBroadcastBitReadThreadDidExit) {
-        // If the thread exited of its own accord, it either means it
-        // hit an end-of-file condition or an error.
-        status = m_pass_status;
-        if (error_ptr)
-          *error_ptr = std::move(m_pass_error);
+    // Re-check for data, as it might have arrived while we were setting up our
+    // listener.
----------------
labath wrote:
> mgorny wrote:
> > Can you think of any reason not to move listener setup before the first `GetCachedBytes()` call instead of duplicating it?
> The only possible reason is "efficiency" (avoiding the creation of the listener and all that goes with it). But I'm definitely not convinced that this actually matters.
Ok, I'm not bent on it either way.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133410



More information about the lldb-commits mailing list