curl-library
Can I use multiple handles at the same time time, not in parallel, in 1 thread.
Date: Mon, 26 Nov 2012 22:28:56 +0000 (GMT)
hieveryone,
Can I have multiple handles in use at one time in one thread?
I don't want to use multi-curl as I'm not interested in having transfers happen in parallel.
The use of the 2nd handle is only in an unlikely error case so I'm not worried by the performance of it.
Actually the code with the 2nd handle is tucked away in another file with other error stuff... I've just simplified the code below.
I thought that this would be fine, but then I noticed this in the documentation.
"Multi-threading Issues
The first basic rule is that you must never simultaneously share a libcurl handle (be it easy or multi or whatever) between multiple threads. Only use one handle in one thread at any
time."
Here is my program. It sounds like I need to change it? What do you think?
thanks in advance,
Fiona
curl_handle = curl_easy_init();
curl_easy_setopt(curl_handle, CURLOPT_URL, uri1)
curl_easy_perform(curl_handle....)
if (something){
curl_handle2=curl_easy_init();
curl_easy_setopt(curl_handle2, CURLOPT_URL, uri2)
curl_easy_perform(curl_handle2....)
curl_easy_cleanup(curl_handle2)
}
curl_easy_perform(curl_handle);
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-11-26