================
@@ -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
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits