Subject: Re: getaddrinfo() vs. JVM
To: Jaromir Dolecek <jdolecek@NetBSD.org>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-userlevel
Date: 01/09/2005 13:59:46
jdolecek@NetBSD.org (Jaromir Dolecek) writes:

> Charles M. Hannum wrote:
> > > 2) Put a mutex around getservbyname() and/or getaddrinfo().  Is there a way
> > > to do this in libc that will work both with and without libpthread?
> > 
> > I've done this.  See the following patches.
> 
> Is the mutex around the calls to _r() functions really needed?
> If they are marked _r, they should already be reentrant, shouldn't they?

Charles's patch looks okay to me. The mutexes are protecting the
(shared) data structure that the non-_r() functions are passing to the
_r() functions The value returned isn't what's being protected.

        - Nathan