cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_multi_fdset: doc suggests that fdsets are zero-ed before adding?

From: Alien <alien999999999_at_users.sourceforge.net>
Date: Sat, 16 Apr 2005 14:59:58 +0200 (CEST)

> On Fri, 15 Apr 2005, Alien wrote:
>
>> can i use the curl_multi_fdset function to _add_ fds to _existing_
>> fdsets
>> with already other fds in it?
>
> Yes.

thanks for the help

>> so _can_ i use that function to add the curl's internal fds to fdsets
>> with
>> already others in it? if so, the documentation regarding that wasn't
>> clear
>> and suggested that it extracted (and thus overwrites the structures)...
>
> What in the docs did you think wasn't clear enough? You have any
> suggestions
> on how we should've phrased it to make it more obvious?

this is how it is now: "This function extracts file descriptor information
from a given multi_handle. libcurl returns its fd_set sets. The
application can use these to select() on. The curl_multi_perform(3)
function should be called as soon as one of them are ready to be read from
or written to."

maybe it'd be better like this: "This function adds file descriptors from
a given multi_handle to existing fd_set sets. The application can use
these to select() on, but be sure to FD_ZERO them before calling this
function. The curl_multi_perform(3) function should be called as soon as
one of them are ready to be read from or written to."

does that seem good? It that i've seen a lot of people useing this, then
checking FD_ISSET and adding them again to an fd_set to be used in select,
while as I understand it, it's better to FD_ZERO them first, call this
function and add some of your own in any order and calling select right
after that.

I have seen in the archives that there was a discussion about replacement
functions, was there any consensus? I do hope that this function does not
disappear, it makes select stuff alot easier.
Received on 2005-04-16