Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Apr 2000 13:03:47 -0700
From:      Arun Sharma <adsharma@sharmas.dhs.org>
To:        Ming Zhang <ming@yahoo-inc.com>
Cc:        hackers@freebsd.org
Subject:   Re: Multithread safe gethostbyname() ?
Message-ID:  <20000412130347.A19577@sharmas.dhs.org>
In-Reply-To: <Pine.BSF.4.10.10004112344320.86949-100000@pious.yahoo.com>; from Ming Zhang on Wed, Apr 12, 2000 at 12:07:40AM -0700
References:  <200004120538.WAA17491@sharmas.dhs.org> <Pine.BSF.4.10.10004112344320.86949-100000@pious.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Apr 12, 2000 at 12:07:40AM -0700, Ming Zhang wrote:
> > In your case, both the threads are waiting for a DNS server response,
> > so the thread scheduler doesn't have a thread to schedule.
> 
> If I only create one thread, then the gethostbyname() returns immediately. 
> By using truss -p, it seems that gethostbyname() uses a static socket var
> for the DNS I/O rather than a local one, and that I think is what caused
> the threads to hang.  Or, we're talking about the same thing?

Ah, I see. So your problem is due to the non-reentrant nature of the
implementation rather than the blocking nature (as I assumed earlier).

While we're on the topic, it'd also be useful to have a DNS lookup
mechanism, that's per domain/adapter. If I have a laptop connected to
two private domains foo.com and bar.com, I wan't nslookups on *.foo.com
to go to one DNS server and *.bar.com to another. That'd require a per
domain or per adapter /etc/resolv.conf

	-Arun


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000412130347.A19577>