cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Reusing easy handle from multiple threads

From: Ben Noordhuis <info_at_bnoordhuis.nl>
Date: Tue, 19 Apr 2011 09:48:36 +0200

On Tue, Apr 19, 2011 at 03:53, Vladimir Grishchenko <vladgri_at_hotmail.com> 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.

[1] http://curl.haxx.se/libcurl/c/threaded-ssl.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-19