================
@@ -27,11 +27,13 @@ class TestLogHandler : public LogHandler {
       : m_stream_sp(stream_sp) {}
 
   void Emit(llvm::StringRef message) override {
+    std::lock_guard<std::mutex> guard(m_mutex);
----------------
slydiman wrote:

Probably I can separate this change to another patch. It is not related to the 
socket sharing. It is the fix of an old bug. 
Host::LaunchProcess() requires to SetMonitorProcessCallback. This callback is 
called from the child process monitor thread. We cannot control this thread. 
lldb-server may crash if there is a logging around this callback because 
TestLogHandler is not thread safe.
I've kept this code here for now because I faced this issue only debugging this 
patch with 100 simultaneous child processes. It is hard to reproduce it other 
way. Note also [this 
comment](https://github.com/llvm/llvm-project/pull/101283#issuecomment-2259628620).

https://github.com/llvm/llvm-project/pull/101283
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to