[Lldb-commits] [lldb] [lldb] Adjust MainLoop on Win32 to work with mingw (PR #163419)

via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 14 09:25:37 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: John Harrison (ashgti)

<details>
<summary>Changes</summary>

This adjusts the monitor tear down to only call CancelIoEx a single time, which should cancel all IO operations in the monitoring thread, instead of calling it in a loop.

This removes the `m_monitor_thread.native_handle()` call that returns a different type on windows/mingw compiles with pthreads enabled and should fix #<!-- -->162801.

---
Full diff: https://github.com/llvm/llvm-project/pull/163419.diff


1 Files Affected:

- (modified) lldb/source/Host/windows/MainLoopWindows.cpp (+1-5) 


``````````diff
diff --git a/lldb/source/Host/windows/MainLoopWindows.cpp b/lldb/source/Host/windows/MainLoopWindows.cpp
index c0b10797e506a..9b7df10258bcd 100644
--- a/lldb/source/Host/windows/MainLoopWindows.cpp
+++ b/lldb/source/Host/windows/MainLoopWindows.cpp
@@ -55,11 +55,7 @@ class PipeEvent : public MainLoopWindows::IOEvent {
     if (m_monitor_thread.joinable()) {
       m_stopped = true;
       SetEvent(m_ready);
-      // Keep trying to cancel ReadFile() until the thread exits.
-      do {
-        CancelIoEx(m_handle, /*lpOverlapped=*/NULL);
-      } while (WaitForSingleObject(m_monitor_thread.native_handle(), 1) ==
-               WAIT_TIMEOUT);
+      CancelIoEx(m_handle, /*lpOverlapped=*/NULL);
       m_monitor_thread.join();
     }
     CloseHandle(m_event);

``````````

</details>


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


More information about the lldb-commits mailing list