cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_global_init and curl_easy_init functions

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 26 Apr 2013 23:33:59 +0200 (CEST)

On Fri, 26 Apr 2013, Aldrich wrote:

> as the tutorial says curl_global_init function is not thread safe,I find the
> examples all put this function before curl_global_init,

You mean before curl_easy_init, right ?

> can I remove this function before curl_easy_init,and donot use it?

If you do, libcurl will instead call it from within curl_easy_init() - as
documented.

> or if I write multi-thread program then I should add curl_global_init
> function?

Is this really not clear in the documentation? curl_global_init() should be
used explicitly if you want proper control of your threads.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-04-26