[Lldb-commits] [lldb] [lldb] Adding file and pipe support to lldb_private::MainLoopWindows. (PR #145621)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 27 02:07:01 PDT 2025
================
@@ -313,8 +318,39 @@ Socket::DecodeHostAndPort(llvm::StringRef host_and_port) {
}
IOObject::WaitableHandle Socket::GetWaitableHandle() {
- // TODO: On Windows, use WSAEventSelect
+#ifdef _WIN32
+ if (m_socket == kInvalidSocketValue)
+ return kInvalidHandleValue;
+
+ if (m_waitable_handle == kInvalidHandleValue) {
+ m_waitable_handle = WSACreateEvent();
+ assert(m_waitable_handle != WSA_INVALID_EVENT);
+ if (WSAEventSelect(m_socket, m_waitable_handle,
+ FD_ACCEPT | FD_READ | FD_WRITE) != 0)
----------------
labath wrote:
I think it should be fine as long as we call (like you do now) WSAEventSelect right before blocking. It probably won't work if those selects happen on different threads (concurrently), but I'm not worried about that. The "use case" I have in mind is someone getting a callback notification doing *another* select to confirm that the data is indeed readable (that's kind of what happens with ConnectionFileDescriptor right now).
https://github.com/llvm/llvm-project/pull/145621
More information about the lldb-commits
mailing list