On Thu, Jan 21, 1999 at 02:00:53PM -0800, Kurt D. Zeilenga wrote:

> > For kernel threading you just use libc.  Whether or not libc generates
> > thread safe (re-entrant) calls depends on whether its also linked with
> > a library that 1) sets __isthreaded to a non-zero value, 2) has a 
> > _spinlock()
> > implementationm, and 3) implements the functions flockfile, funlockfile, 
> > etc.
> > There are also a few macros in header files that require _THREAD_SAFE to
> > be defined to be thread safe.
> 
> 
> I was hoping to be able to produce one ldap library that could be safely
> linked with or without threads.  However, if I must define _THREAD_SAFE
> to generate code to be linked with threads then I must produce two libraries
> (-lfoolib compiled with -U_THREAD_SAFE and -lfoolib_r with -D_THREAD_SAFE).

_THREAD_SAFE is only used in stdio.h.  Looking at what's there, it could
be rewritten to eliminate _THREAD_SAFE entirely, at a (very slight)
performance penalty.  You'd have to check __isthreaded (could be done
once, instead of twice, as in the code now) each time you call one
of the functions defined within the _THREAD_SAFE switch.  All
_THREAD_SAFE does is let you avoid checking __isthreaded when you're
not threaded.

-- 
Richard Seamman, Jr.          email: d...@tar.com
5182 N. Maple Lane            phone: 414-367-5450
Chenequa WI 53058             fax:   414-367-5852

To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message

Reply via email to