cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Threading question

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 16 May 2007 11:00:15 -0700

On Wed, May 16, 2007 at 02:26:03PM +0300, Yariv, Ron wrote:
> I want to use libcurl in a library I need to write. This library will be used
> in a program which involves more than one thread which I can't control.
>
> According to the libcurl documentation I have to call the curl_global_init()
> and curl_global_cleanup() when there is only one thread. Is that mean that if I
> have no control on the main program threads I can't use libcurl?

It means your library's API needs to have the same restriction as libcurl
does. e.g. "You must call libron_init() before any threads have been
created." If your library is going to be used on a single platform and
portability isn't a concern, you may be able to use a platform-specific
method to cause your initialization code to run as the library is loaded,
before the application starts.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2007-05-16