cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Is it safe not to perform curl_global_init()?

From: <centrio_at_gmail.com>
Date: Thu, 26 Mar 2009 05:00:32 +0000

On Wed, 25 Mar 2009, centrio_at_gmail.com wrote:

> Libcurl documentation specifies some restriction on curl_global_init()
> function (when used in multi threading env). In my application I am not
> using curl_global_init. Instead I am getting an easy_handle using
> easy_init
> and then performing easy_perform on this handle. Everything works fine. I
> have tested this code with some 1000 URLs, and have not found any
> problem. I
> wanted to know, what could be the results of not using curl_global_init()
> and directly using easy_perform on easy_handle. What can be possible
> problems in this approach.

> If you don't call curl_global_init() on your own, libcurl will do it for
> you.
> And if you do that in a thread, then you risk that more than one thread
> calls
> it at the same time and then of course all sorts of problems can arise as
> it
> is not thread-safe.
> --
> / daniel.haxx.se

Do you mean to say, the current code, which does not use global_init() is
also not thread safe?
Received on 2009-03-26