================
@@ -391,8 +392,13 @@ bool Debugger::SetTerminalWidth(uint64_t term_width) {
 
   if (auto handler_sp = m_io_handler_stack.Top())
     handler_sp->TerminalSizeChanged();
-  if (m_statusline)
-    m_statusline->TerminalSizeChanged();
+
+  {
+    // This might get called from a signal handler.
+    std::unique_lock<std::mutex> lock(m_statusline_mutex, std::try_to_lock);
+    if (m_statusline)
----------------
bulbazord wrote:

I assume you only intend to call `TerminalSizeChanged` when the lock is 
acquired? This then needs to be `if (lock && m_statusline)`. Otherwise this has 
the exact same behavior with or without your change.

But one thing I'm not sure about is, if you see `SIGWINCH` and it tries to 
change the window size but fails because it can't acquire the lock, when does 
the terminal size get updated again?  Does it have to wait for another 
`SIGWINCH` or does this code run again later when the lock is free?

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

Reply via email to