> Am 28.08.2023 um 13:06 schrieb Patrick Monnerat via curl-library 
> <curl-library@lists.haxx.se>:
> 
> 
> On 8/28/23 12:51, Stefan Eissing via curl-library wrote:
>> 
>>> Am 28.08.2023 um 12:41 schrieb Daniel Stenberg <dan...@haxx.se>:
>>> 
>>> On Mon, 28 Aug 2023, Stefan Eissing via curl-library wrote:
>>> 
>>>>>>> CURL **handles = curl_multi_get_handles(multi);
>>>> The tricky part is to handle iterations when easy handles are removed and 
>>>> freed during the iteration. If we save pointers, this can become tedious.
>>> Right, but it has the nice property that it is a fixed snapshot in time. 
>>> When you iterate over this list and remove handles or even add new handles 
>>> to the multi, this list is already created and remains unmodified.
>>> 
>>> Almost all other iterating APIs will be harder to document and possibly to 
>>> use, when you remove and add handles while traversing the handles.
>> Yes, that is why I propose a snapshot (internal, invisible) of the transfer 
>> ids. Then the caller can even free handles during iteration without 
>> headaches.
> 
> Internally managing a snapshot can also be a headhache and adds a processing 
> overhead that will be unused in most cases.

> I think letting the array update to the caller's responsibility is much 
> simpler and does not bring much bloat to the calling program.

Well, thanks for "bloat".=)

Daniels proposal addresses the call this thread started with. You get the list, 
your free all handles, you free the list and done.

What this does not allow is to expose an Iterator object in a language binding. 
In a way that you do not easily shoot yourself int the foot. Because then you'd 
have to think about things like

def x(self, easy)
  for easy2 in self.multi:
     if same_host(easy, easy2):
        shutdown(easy2)

def y(self)
  for easy in self.multi:
     self.x(easy)

We can declare this out-of-scope. Then the list will work well.

> -- 
> Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
> Etiquette:   https://curl.se/mail/etiquette.html


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to