cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Multi-threading

From: Alan Wolfe <alan.wolfe_at_gmail.com>
Date: Wed, 28 Sep 2011 09:10:09 -0700

only a partial answer but have you seen this page?

http://curl.haxx.se/libcurl/features.html

libcurl is designed and implemented entirely thread safe. There are some
considerations to keep in mind when using libcurl in multiple threads
though, as mentioned below:

*Never* share libcurl handles between multiple threads. You should only use
one handle in one single thread at any given time. You can still share
certain data between multiple threads by using the share
interface<http://curl.haxx.se/libcurl/c/libcurl-share.html>.

libcurl uses certain system calls to obtain information. Some of the most
crucial ones are the name resoluition calls (the *gethostby** family). It is
very important that libcurl found and can use thread safe versions of these
and other system calls, as otherwise it can't function fully thread safe.

Some operating systems are known to have faulty thread implementations. We
have previously received problem reports on *BSD (at least in the past, they
may be working fine these days). Some operating systems that are known to
have solid and working thread support are Linux, Solaris and Windows.
Further, if you use any SSL/TLS-based protocol (HTTPS or FTPS) you need to
setup OpenSSL or GnuTLS callbacks for synch. See the
libcurl-tutorial(3)<http://curl.haxx.se/libcurl/c/libcurl-tutorial.html#Multi-threading>man
page for details.

On Wed, Sep 28, 2011 at 8:22 AM, Julien <eldebaran_at_gmail.com> wrote:

> Hi,
>
> I am not sure to understand correctly what the limitations of lib-curl
> are in a multi-threaded environment.
>
> According to the programming tutorial, it is quite clear that a handle
> cannot be used simultaneously by several threads.
>
> However, provided simultaneous access is guaranteed not to happen
> (e.g. thanks to locking mechanisms), is it allowed to use the same
> handle through different threads during its lifetime?
>
> Thank you in advance,
> Julien
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

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