On 12-Apr-00 Dan Moschuk 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.
>| 
>| No. :(  Until we get one you can work around it by using a mutex around
>| calls to gethost* to allow only 1 thread to call them at a time.
> 
> That won't work either, since, if I remember correctly, the returned
> struct hostent is static.

Yeah, so you would have to copy them to a new hostent while holding the
lock.

> -Dan
> -- 
> Dan Moschuk ([EMAIL PROTECTED])
> "Waste not fresh tears on old griefs."

-- 

John Baldwin <[EMAIL PROTECTED]> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.cslab.vt.edu/~jobaldwi/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to