cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: about function CURLMOPT_TIMERFUNCTION

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 5 Jan 2015 23:04:37 +0100 (CET)

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-05