[Lldb-commits] [lldb] [lldb] Add timeout argument to Socket::Accept (PR #117691)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 26 02:27:23 PST 2024


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


More information about the lldb-commits mailing list