[Lldb-commits] [lldb] [lldb][windows] fix a race condition when closing the ConPTY (PR #182302)
via lldb-commits
lldb-commits at lists.llvm.org
Sat Feb 21 06:26:21 PST 2026
================
@@ -71,10 +88,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 bool &IsStopping() const { return m_stopping; };
----------------
Nerixyz wrote:
```suggestion
bool IsStopping() const { return m_stopping.load(); };
```
There's technically an `operator T` for `std::atomic` but an explicit `load` makes it more clear imo.
https://github.com/llvm/llvm-project/pull/182302
More information about the lldb-commits
mailing list