[Lldb-commits] [lldb] [lldb] Synchronize the debugger's stdout and stderr streams (PR #126630)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 13 01:47:00 PST 2025


================
@@ -574,10 +581,10 @@ int Editline::GetCharacter(EditLineGetCharType *c) {
     // indefinitely. This gives a chance for someone to interrupt us. After
     // Read returns, immediately lock the mutex again and check if we were
     // interrupted.
-    m_output_mutex.unlock();
+    m_output_stream_sp->GetMutex().unlock();
----------------
labath wrote:

What would you say if, instead of exposing rather non-RAII method on the generic class, we worked around this issue (the issue being us wanting to put libedit code in a critical section) locally, by having something like `std::optional<LockedStream> m_locked_output` member on the editline class? GetLine could set this member when doing its work, and here we would clear it before blocking, and re-set it immediately afterwards.

https://github.com/llvm/llvm-project/pull/126630


More information about the lldb-commits mailing list