nss and pthreads and wine, oh my!

Daniel Eischen eischen at vigrid.com
Wed Dec 10 12:04:39 PST 2003


On Wed, 10 Dec 2003, Jacques A. Vidrine wrote:

> On Wed, Dec 10, 2003 at 12:39:59AM -0500, Daniel Eischen wrote:
> > Yes, I think libc should only call locking primitives when
> > __isthread != 0.
> 
> Hi Dan,
> 
> You don't mean that, do you?  You seem to be implying that pthread
> functions would have to be invoked in libc something like this:
> 
>   result = __isthreaded ? _pthread_mutex_trylock(&foo_lock) : 0;
>   if (result != 0)
>           /* error */;
> 
> or use the macros in reentrant.h.
> 
> But, maybe I'm just misunderstanding you.  I believe the thread
> functions are `stubbed out' in the non-thread case?

They are, but when libpthread is linked in, even if threads
are not created, there's no reason to call the pthread sync
functions if we're not threaded.  There is a bit of overhead
associated with calling these things that can be avoided
simply by checking __isthreaded.

-- 
Dan Eischen



More information about the freebsd-current mailing list