cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re:Re: about function CURLMOPT_TIMERFUNCTION

From: À¼Ìì <lantian0811_at_163.com>
Date: Tue, 6 Jan 2015 09:51:01 +0800 (CST)

thanks for replying.
before the first time callback function called ,at this time,we do not know the timeout time,right? so how could value timeout changed,and how could callback function called?

In the example file hiperfifo.c , the first time callback function "timer_cb"called,and in that callback function ,we know the value of timeout_ms is 1ms,before this callback function called ,we did not know this value ,right?
so I am so confused about the prerequisite of this callback function ?
best wishes
knuth

At 2015-01-06 06:04:37, "Daniel Stenberg" <daniel_at_haxx.se> wrote:
>On Mon, 5 Jan 2015, À¼Ìì wrote:
>
>> CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_TIMERFUNCTION,
>> timer_callback);
>>
>> and I know that when the timeout changed,the callback function are called,
>> however,the first time we register the callback function ,for example:
>>
>> curl_multi_setopt(handle, CURLMOPT_TIMERFUNCTION, timer_cb);
>> and the callback function is
>> int timer_cb(CURLM *multi, long timeout_ms,void *userp)
>> {
>> ......
>> }
>
>> the second paramenter timeout_ms value is ?.
>
>
>Well, before the callback is ever called, the argument of course hasn't gotten
>any value.
>
>> I read the docs/example hiperfifo.c ,and I see the log ,this value is
>> 1ms,how did this value come?
>
>In many cases, the first timeout that the callback will be told about is 1ms
>into the future.
>
>--
>
> / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-01-06