cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Using libcurl in a multithreaded app

From: Lars Nilsson <chamaeleon_at_gmail.com>
Date: Thu, 8 Jun 2006 11:33:36 -0400

On 6/8/06, securehell_at_hushmail.com <securehell_at_hushmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi group,
>
> I am writing a multithreaded app that uses libcurl to download from
> various links. Each thread in the app downloads a link using its
> own libcurl functions (i.e. curl_easy_init(), curl_easy_setopt(),
> curl_easy_perform() and curl_easy_cleanup()).
>
> My question: Can I globally set the curl options or do I have to go
> through the procedure of setting the curl options for each thread
> that calls curl_easy_perform()? I am experiencing intermittent
> crashes due to malloc problems (all of my mallocs are checked) and
> I am trying to optimize the app in any way possible.
>
> Any advice would be apprectiated.
>
> SH

Not addressing your crashing issues, really, but in the grand scale of
things, do you think the time spent setting options will be anywhere
near the time spent for that curl handle waiting for data to be
sent/received in curl_easy_perform()? This sounds like a classic case
of premature optimization to me.

Lars Nilsson
Received on 2006-06-08