Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl_multi_poll: a sister to curl_multi_wait() that waits more #4163

Closed
wants to merge 1 commit into from

Conversation

@bagder
Copy link
Member

bagder commented Jul 29, 2019

Repeatedly we see problems where using curl_multi_wait() is difficult or
just awkward because if it has no file descriptor to wait for
internally, it returns immediately and leaves it to the caller to wait
for a small amount of time in order to avoid occasional busy-looping.

This is often missed or misunderstood, leading to underperforming
applications.

This change introduces curl_multi_poll() as a replacement drop-in
function that accepts the exact same set of arguments. This function
works identically to curl_multi_wait() - EXCEPT - for the case when
there's nothing to wait for internally, as then this function will by
itself wait for a "suitable" short time before it returns. This
effectiely avoids all risks of busy-looping and should also make it less
likely that apps "over-wait".

This also changes the curl tool to use this funtion internally when
doing parallel transfers and changes curl_easy_perform() to use it
internally.

@bagder bagder added the libcurl API label Jul 29, 2019
@bagder bagder force-pushed the bagder/curl_multi_poll branch from 0e73aaf to 08b5aad Jul 29, 2019
Repeatedly we see problems where using curl_multi_wait() is difficult or
just awkward because if it has no file descriptor to wait for
internally, it returns immediately and leaves it to the caller to wait
for a small amount of time in order to avoid occasional busy-looping.

This is often missed or misunderstood, leading to underperforming
applications.

This change introduces curl_multi_poll() as a replacement drop-in
function that accepts the exact same set of arguments. This function
works identically to curl_multi_wait() - EXCEPT - for the case when
there's nothing to wait for internally, as then this function will by
itself wait for a "suitable" short time before it returns. This
effectiely avoids all risks of busy-looping and should also make it less
likely that apps "over-wait".

This also changes the curl tool to use this funtion internally when
doing parallel transfers and changes curl_easy_perform() to use it
internally.
@bagder bagder force-pushed the bagder/curl_multi_poll branch from afb0037 to 625f006 Jul 30, 2019
@bagder

This comment has been minimized.

Copy link
Member Author

bagder commented Jul 31, 2019

Plan: leave this open here for feedback and possible discussions for a week before I land it, should there be no big opposition. Brought up on the mailing list and twitter.

@bagder

This comment has been minimized.

Copy link
Member Author

bagder commented Aug 1, 2019

For some reason the #4179 clone PR of this seems to have made the CI builds restart in this PR... ?

@bagder bagder closed this in 02346ab Aug 6, 2019
@bagder bagder deleted the bagder/curl_multi_poll branch Aug 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
1 participant
You can’t perform that action at this time.