cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: resolver thread deadlock during Windows DLL attach

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 1 Jan 2008 23:04:13 +0100 (CET)

On Sun, 30 Dec 2007, Mohun Biswas wrote:

> So the question is: is there a way to get the hostname resolved without
> spawning a new thread? I've not followed any libcurl DNS discussions in the
> past because we're at the other end of the spectrum where we only need to
> resolve one hostname once. In fact I could probably work around this by
> using a wrapper program to convert it to an IP address and place that in the
> environment but I'm hoping for a cleaner solution.
>
> I know there's a thing called c-ares but that seems to be going the wrong
> direction. What I think I need is a *synchronous* resolver that will work in
> the current thread (but then I don't claim to understand DNS).

In fact, using c-ares would solve your problem and still allow the name
resolve to get timed out (if you want to). But it would also add another lib
of course...

The alternative to that, is to make sure USE_THREADING_GETHOSTBYNAME isn't
defined in lib/setup.h when you build libcurl as then it won't build with a
threaded resolver but instead use the built-in fallback method: plain
synchronous lookup with gethostbyname().

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-01-01