================
@@ -128,19 +131,28 @@ llvm::Error PseudoConsole::OpenPseudoConsole() {
   return llvm::Error::success();
 }
 
+bool PseudoConsole::IsConnected() const {
+  return m_conpty_handle != INVALID_HANDLE_VALUE &&
+         m_conpty_input != INVALID_HANDLE_VALUE &&
+         m_conpty_output != INVALID_HANDLE_VALUE;
+}
+
 void PseudoConsole::Close() {
-  Sleep(50); // FIXME: This mitigates a race condition when closing the
-             // PseudoConsole. It's possible that there is still data in the
-             // pipe when we try to close it. We should wait until the data has
-             // been consumed.
+  SetStopping(true);
----------------
charles-zablit wrote:

I think it depends: if the ConPTY is not being read from by 
`ConnectionPTYWindows` then yes it's fine to return early.
If it was being read from by `ConnectionPTYWindows`, we still need to ensure 
that we call `m_cv.notify_all();` and set `m_stopping` to `false` otherwise the 
read thread will hang.
If a thread is waiting on the cv to be notified, we need to make sure we always 
notify it.

https://github.com/llvm/llvm-project/pull/182302
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to