labath wrote:

I can sort of see your point, but I also disagree with it. :)

It's true that in this case (the blocking version of Socket::Accept), a timeout 
argument to MainLoop::Run would be sufficient (and probably look cleaner), but 
it's not very generic. Like, imagine you had a "proper" long-lived MainLoop 
object (like the one we have in lldb-server), and you wanted to use that to 
wait for a connection. You couldn't pass a timeout to the Run function there. 
Instead, you'd probably schedule a callback to unregister the accept handle 
after a certain amount of time.

In this mindset, I view the blocking Accept function as a sort of a convenience 
wrapper on top of that functionality and its goal is to provide a simple 
interface for the cases where all you want to do wait for a connection.

https://github.com/llvm/llvm-project/pull/117691
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to