cURL / Mailing Lists / curl-library / Single Mail

curl-library

multi-threaded application using libcurl, about synchronized access

From: Selçuk Cihan <selcukcihan_at_gmail.com>
Date: Wed, 3 Feb 2010 19:18:28 +0200

Hi, quoting from documentation,
 "The first basic rule is that you must never share a libcurl handle
(be it easy or multi or whatever) between multiple threads. Only use
one handle in one thread at a time."

I would like to know if this basic rule applies to synchronized
access? Calls to curl api are guarded by mutexes, is this enough? In
callback functions i do not use mutexes, i just lock the mutex before
calling curl_multi_perform, hopefully callbacks are also protected by
the mutex.

I implemented the above mutex guarded multi-threaded application, and
i am getting segfaults from libcurl calls randomly, that is why i
would like to know if i am doing the wrong thing by calling curl from
different threads.

Thanks in advance for any help
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-02-03