In muc.lists.freebsd.hackers, you wrote:
>
> Is there a MT-safe implementation of gethostbyname() in FreeBSD (3.4/4.0)?
>
> On Solaris there is gethostbyname_r(). Calling gethostbyname() with in
> two threads cause both threads to block.
You seem to be talking about two different things:
1. A reentrant function - two different threads can be in the same function
simultaneously
2. A non blocking function.
Reading the code in /usr/src/lib/libc{,_r}, it appears to me that, the
FreeBSD implementation is not reentrant, and blocking. However,
gethostbyname calls poll(2), which causes a reschedule to another runnable
pthread, if any.
In your case, both the threads are waiting for a DNS server response,
so the thread scheduler doesn't have a thread to schedule.
I think it'd be very useful to have a non-blocking DNS lookup API (one
which exposes the underlying file descriptor) . Winsock has this. UNIX
netscape 4.x would freeze half as often if this was done right.
-Arun
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message