[Lldb-commits] [lldb] [lldb][windows] fix a race condition when closing the ConPTY (PR #182302)

via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 20 09:25:16 PST 2026


================
@@ -71,10 +92,33 @@ class PseudoConsole {
   /// then drain all output before launching the actual debuggee.
   llvm::Error DrainInitSequences();
 
+  /// Returns a reference to the mutex used to synchronize access to the
+  /// ConPTY state.
+  std::mutex &GetMutex() { return m_mutex; };
+
+  /// Returns a reference to the condition variable used to signal state changes
+  /// to threads waiting on the ConPTY (e.g. waiting for output or shutdown).
+  std::condition_variable &GetCV() { return m_cv; };
+
+  /// Returns whether the ConPTY is in the process of shutting down.
+  ///
+  /// \return
+  ///     A reference to the atomic bool that is set to true when the ConPTY
+  ///     is stopping. Callers should check this in their read/write loops to
+  ///     exit gracefully.
+  const std::atomic<bool> &IsStopping() const { return m_stopping; };
----------------
Nerixyz wrote:

This can return the `bool` value - all uses call `.load` immediately.

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


More information about the lldb-commits mailing list