cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: threading issue

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 28 Jul 2005 01:04:19 +0200 (CEST)

On Wed, 27 Jul 2005, Arnaud Compan wrote:

> >Hm. Would it suffice for your case if we made the init variable a true
> >global?

> I don't think it would be sufficient. The problem is that the
> random_the_seed() function is called many times until the value of
> ssl_seeded switchs to TRUE. May be it would be possible to call the seeding
> function at cURL initialisation (in Curl_SSL_init() for example).

That's unfortunately not possible. It uses several options that might be set
in the handle using curl_easy_setopt().

> Another idea is to allow only one thread to call the seeding function. Other
> threads should wait until seeding is done. But it seems to be more difficult
> to do without things like mutex.

Yes, and libcurl must remain thread agnostic.

Another not-so-very-nice way would be to add an option that specificly tells
libcurl to _not_ random the seed for a specific handle, which can be used for
multi-threaded programs that know that it already has been taken care of by
another thread.

> Anyway, we use cURL library to do HTTP/HTTPS requests in a multi-threaded
> application and it works just fine. It's really a very good tool.

Thanks!

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-07-28