curl-library
Re: Wait for a response using curl_multi_wait
Date: Wed, 21 Mar 2018 18:44:30 +0000
On 21 March 2018 at 14:35, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Tue, 20 Mar 2018, Cunningham, Joel wrote:
>
>> 1) Make the new API behave just poll/select, i.e. it can be used as a
>> blocking construct even when there are no input FDs.
> An alternative design could be to add a curl_multi_setopt() option that
> changes how curl_multi_wait() behaves, but I figure that is slightly more
> subtle...
+1 on making it like poll/select. As recent new user to
curl_multi_wait the example in the doc confused the hell out of me.
Ended up copying it "just because it was there" which is entirely
unsatisfying!
Adding a new option seems it'll just make the doc for curl_multi_wait
even more confusing. So unless there are other strong reasons not to
add a new function, I like curl_multi_poll.
Richard
On 21 March 2018 at 14:35, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Tue, 20 Mar 2018, Cunningham, Joel wrote:
>
>> 1) Make the new API behave just poll/select, i.e. it can be used as a
>> blocking construct even when there are no input FDs.
>
>
> I decided to make an attempt and it turned out making a new function called
> curl_multi_poll() that does exactly this requried a *minimal* change:
>
> https://github.com/curl/curl/pull/2415
>
> There's no docs and no tests or anything but I'm interested in thoughts and
> feedback. It basically acts exactly like curl_multi_wait, *but* if there's
> nothing to wait for it will wait for the timeout period (or shorter if the
> multi handle as a timeout set that expires before the given timeout).
>
> If we are to add a new function, we might as well make sure that we correct
> all the problems we can think of while at it!
>
> An alternative design could be to add a curl_multi_setopt() option that
> changes how curl_multi_wait() behaves, but I figure that is slightly more
> subtle...
>
> --
>
> / daniel.haxx.se
>
> -------------------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-03-21