cURL / Mailing Lists / curl-library / Single Mail

curl-library

interruptible curl_easy_perform()

From: Bryan Henderson <bryanh_at_giraffe-data.com>
Date: 18 Feb 2007 22:09:00 +0000

I wrote some code to make transfer in curl_easy_perform() interruptible
by signals, but I ran into two complications:

1) I was wrong when I said the transfer waits in select(). On a
system that has poll(), it waits in poll(). On a system that doesn't
have poll(), it waits in select().

My proposal was to replace select() with pselect() where available, and
pselect() is almost identical to select(). There is no analogous
replacement for poll().

Question: Why is poll() preferred? It provides a slightly more capability
than select(), but libcurl doesn't seem to exploit it.

I note that the code refuses to build on a system that does not have
select(), even if it uses only poll().

2) libcurl does not call the user's progress function if it already
called it within the same second. The comment indicates that it
really just wants to avoid updating speed measurements more than once
a second. So I changed the code so it just skips the recalculations
if it has already done them within the same second. The progress function
may be called twice in the same second, and the builtin progress meter
may run twice in the same second as well.

Is that bad? I read in the archives that this callback is supposed to
be for aborting downloads as well as for displaying progress bars, so
it makes sense that the requirements of the speed calculations
wouldn't control it.

-- 
Bryan Henderson                                   San Jose, California
Received on 2007-02-18