[Lldb-commits] [lldb] [lldb] Adjust MainLoop on Win32 to work with mingw (PR #163419)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 14 09:24:10 PDT 2025
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/163419
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.
>From b33aaee0f71b5efd55dedfcae7c7bbea0c58d642 Mon Sep 17 00:00:00 2001
From: John Harrison <harjohn at google.com>
Date: Tue, 14 Oct 2025 09:20:34 -0700
Subject: [PATCH] [lldb] Adjust MainLoop on Win32 to work with mingw
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.
---
lldb/source/Host/windows/MainLoopWindows.cpp | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
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);
More information about the lldb-commits
mailing list