[Lldb-commits] [PATCH] D145136: Add a Debugger interruption mechanism in parallel to the Command Interpreter interruption

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 15 11:45:16 PDT 2023


JDevlieghere added inline comments.


================
Comment at: lldb/source/Core/Debugger.cpp:1973-1977
+HostThread &Debugger::SetIOHandlerThread(HostThread &new_thread) {
+  HostThread &old_host = m_io_handler_thread;
+  m_io_handler_thread = new_thread;
+  return old_host;
+}
----------------
bulbazord wrote:
> JDevlieghere wrote:
> > This doesn't look right. You're taking a reference to the old thread, and then immediately change it below. If you want to return the old thread, old_host should be a copy. 
> +1. Does it make sense to use a shared_ptr or a unique_ptr for HostThreads? If so, we could use those.
I think the HostThread already kind of serves as a wrapper. I think the solution is to either just make a plain copy or call `Release()` and assign it to the `old_host` temporary. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145136



More information about the lldb-commits mailing list