On 10/8/05, Zoran Vasiljevic <[EMAIL PROTECTED]> wrote:
> No luck: this (NetBSD) system does not have any MT-safe call.
> What I did:
>
> During the configure I emit the warning if compiling under Darwin.
>
> checking for getaddrinfo in -lsocket... no
> checking for getnameinfo in -lsocket... no
> checking for getaddrinfo... yes
> checking for getnameinfo... yes
> checking for gethostbyname_r... no
> checking for gethostbyaddr_r... no
> configure: WARNING: DNS queries will use non-threadsafe calls which
> could result in server instability
>
> In dns.c I added
>
> #ifdef __APPLE__
>     Ns_Cs cs;
>     Ns_CsEnter(&cs);
>     ...
>     Ns_CsLeave(&cs);
> #endif
>
> to cope with this *at least* within our own program. This does not
> guarantee that this is MT-safe because any of the rest of the
> system may call those calls anytime, hence we get problems anyways.



Why can't we fall back to using gethostbyname() on Darwin with it's
mt-unsafe getaddrinfo()?  gethostbyname() is also mt-unsafe, but we
already have a critical section around that.  If we have critical
sections around two separate dns calls which return the same results,
there's really no advantage in choosing one over the other, right?

Reply via email to