cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl callback order

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 25 May 2011 22:09:53 +0200 (CEST)

On Wed, 25 May 2011, Erik Earle wrote:

> I'm new to this and I'm looking at the samples, docs and list archives...

Welcome!

> I cannot find definitive information on whether 'curl_easy_perform' always
> returns after all the calls to 'recv_hdr' and 'recv_data' have returned

It does. While curl_easy_perform() runs, it will call the callbacks to deliver
data as long as there is data coming. When it reaches the end of the transfer,
curl_easy_perform() will return.

> if the call backs are multi-threaded.

Oh, it never struck me you would think that. I guess we can or should clarify
that in the documentation. libcurl will never start a new thread[*] and it
will always call the callbacks from the same thread you're calling
curl_easy_perform() from.

> Is it the same for the share and multi interfaces as the easy?

Yes, but you'll see that no function in the share interface makes any
callbacks trigger.

[*] = libcurl can optionally get built and told to start separate threads for
the purpose of name resolving, but that's completely hidden from the user and
no callbacks will ever be called from such extra "support-thread(s)".

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-05-25