cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Libcurl with non-reentrant gethostbyname - thread safe?

From: Vladimir Grishchenko <vladgri_at_hotmail.com>
Date: Mon, 6 Dec 2010 11:01:10 -0800

See my comments in-line.

> Date: Mon, 6 Dec 2010 19:09:13 +0100
> From: daniel_at_haxx.se
> To: curl-library_at_cool.haxx.se
> Subject: Re: Libcurl with non-reentrant gethostbyname - thread safe?
>
> On Mon, 6 Dec 2010, Vladimir Grishchenko wrote:
>
> > Libcurl noob here. I'm wondering if it is safe to call libcurl from multiple
> > threads if I were to use the non-reentrant variant of gethostbyname.
>
> If libcurl is built to use a non-reentrant variant of gethostbyname, then it
> isn't really thread-safe I guess.
>
> Are you seriously using a system that doesn't have a thread-safe version of
> that function? Just about evertything made during the last 15 years has this
> done right...
>

Hopefully not but not 100% sure as some of the platforms I need to work
with are odd, I guess I'm just evaluation my options and learning.

> > I looked around and didn't see any guards preventing multiple threads from
> > simultaneously entering gethostbyname in libcurl. I'm planning to use
> > synchronous resolver, at least initially, if that matters.
>
> Well, using c-ares for resolving would of course be a way to avoid having to
> use your system's defective gethostbyname implementation... ;-)
>

As for c-ares, does it internally implement the name-resolution protocol
 so it never has to call into the gethostbyname and its
variants/derivatives?

Thanks.

> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> 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 2010-12-06