On 8 Nov 2009, at 17:47, Constantine Sapuntzakis wrote:

Does this patch fix Multi-threading problems on OSX 10.6 even if c- ares is
being used?

This will probably not fix your problems unless you were compiling
libcurl with --disable-ipv6.

As I've integrated libcurl into a multi-threaded program, I've found
I've had to do a couple things to ensure thread safety:
 * when I create a curl object in a thread (e.g. multi handle, easy
handle), I only use it and destroy it in that thread
 * Add locking callbacks so that the DNS hostcache is thread safe:

   curl_share_setopt(g_sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
   curl_share_setopt(g_sh, CURLSHOPT_LOCKFUNC, sh_lock);
   curl_share_setopt(g_sh, CURLSHOPT_UNLOCKFUNC, sh_unlock);

 * Use CRYPTO_set_locking_callback to register a lock callback with
OpenSSL so OpenSSL is thread safe.

What sort of problems are you running into?

-Costa
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Hi Costa,

I launch a lot of connections at the same time, each easy handle is created and destroyed in its own pthread and it works flawlessly until I increase the number of connections to about 20 or above and then curl_easy_perform starts returning error 7 on all new handles.

I have been configuring libcurl with:

./configure --enable-ares

Having read your emails should I also be setting --enable-thread and -- enable-nonblocking?

Regards,

Rob.




-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to