cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl, ActiveX and thread safety

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 19 Dec 2007 23:55:19 +0100 (CET)

On Wed, 19 Dec 2007, Ranger Harke wrote:

> curl_global_init and curl_global_cleanup are marked as thread-unsafe, and
> should never be called "when any other thread is running".

[...]

> I did a bit of poking about in the libcurl source, and it looks to me that,
> in my setup, the only thing that curl_global_init sets up is the Winsock. It
> *feels* like it should be safe to call this from the base thread of my
> ActiveX component (that is to say, before *I* spawn any new threads) but I
> must admit that I know very little about thread safety of Winsock
> initialization.

Well, since you don't use SSL or libidn, you're at least not using a third
party lib that could cause problems. Basically the only thing you risk then is
that you init the winsock stuff twice (since the check in the start of the
function isn't thread-safe), but I guess that's fairly harmless...

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-12-20