cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Reusing easy handle from multiple threads

From: Vladimir Grishchenko <vladgri_at_hotmail.com>
Date: Tue, 19 Apr 2011 10:08:46 -0700

----------------------------------------
> From: info_at_bnoordhuis.nl
>
> On Tue, Apr 19, 2011 at 03:53, Vladimir Grishchenko wrote:
> > T1 acquires H1 from the pool
> > T1 calls curl_easy_setopt(H1)
> > T1 calls curl_easy_perform(H1)
> > T1 returns H1 to the pool
> > T2 acquires H1 from the pool
> > T2 calls curl_easy_setopt(H1)
> > T2 calls curl_easy_perform(H1)
> > T2 returns H1 to the pool
>
> Yes, that's safe (assuming pool operations aren't race-y). You need to
> set up mutexes if you're using SSL, see here[1] for an example.
>

Thanks, currently we don't use SSL but the info will come handy in the future.

----------------------------------------
> From: daniel_at_haxx.se
>
> A cool new feature that would make things a lot easier for your use case is if
> we would allow the share interface to share the connection pool between
> multiple easy handles, as then you could use a single connection pool with an
> arbitrary amount of easy handles and all easy handles could re-use connections
> from the cooperative pool...
>

That would be useful indeed as I imagine you often have the share interface already utilized for DNS/Cookie caching when using easy handles.

-V
                                               
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-19