Subject: Re: getaddrinfo() vs. JVM
To: Charles M. Hannum <abuse@spamalicious.com>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-userlevel
Date: 01/07/2005 16:22:58
"Charles M. Hannum" <abuse@spamalicious.com> writes:

> 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?

Yes. Include "reentrant.h" and use the mutex_lock(), mutex_unlock()
and similarly-named wrappers for mutex and condvar functions. They
will bind to no-op stubs when libpthread is not linked in and the real
libpthread routines when it is linked in. See, for example,
libc/gen/syslog.c.

        - Nathan