cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to deal with multi thread call of curl_multi_socket_action?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 13 Dec 2012 10:33:17 +0100 (CET)

On Thu, 13 Dec 2012, ؛خصً wrote:

Please don't top post! http://curl.haxx.se/mail/etiquette.html#Do_Not_Top_Post

> It's nice suggestion to use multi interface in a single thread.

This makes me a bit curious. Doesn't all our documentation already say that
the multi interface is for doing multiple transfer in the same thread?

> But I made a mistake,I was about to ask the CURLMOPT_TIMERFUNCTION callback
> with the prototype:

> Its comments says:

Let me just remind you that the man pages (also available online) are often
better sources for information about how and why things work as they do.

> I was puzzled here.Why upper layer should implement the callback manually?
> What shall the callback do?

The callback typically sets a timer using your event-based system, and when
that timer fires off you call curl_multi_socket_action() to tell libcurl that
the timeout elapsed. Or the callback gets called again before it times out and
you update it to a new timeout.

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-12-13