labath added a comment.

When I created the `MainLoop` class, i was hoping it would become the central 
place for all select-like functionality. Currently it uses pselect, but i don't 
see a reason we couldn't switch it to ppoll (but we actually don't have to, as 
the current implementation should work just fine for your use case). We also 
can-but-don't-have-to provide a specialized kevent-based implementation for 
mac&freebsd (afaict, kevent also supports listening for signals, but i would be 
fine with leaving that out even, as we don't need that functionality on these 
platforms). So all that needs to be added is a WSAPoll-based MainLoopWindows.

Then your `Listen` implementation would boil down to:

  for (auto socket: sockets)
    handles.emplace_back(loop.RegisterReadObject(socket, [&] { accepted = 
accept(socket, ...); loop.RequestTermination(); });
  loop.Run();

I'm not married to the current MainLoop interface in any way, so we can change 
it if you find the current one cumbersome, but I would like to cut down the 
number of selecting pieces of code.

What do you think about that?



================
Comment at: source/Host/common/TCPSocket.cpp:284
+#if defined(_WIN32)
+    int retval = WSAPoll(sock_set.data(), sock_set.size(), 1000);
+#else
----------------
Why not simply use infinite timeout if that's the behaviour you desire?


https://reviews.llvm.org/D31823



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to