Subject: Re: libpthread busted?
To: Bill Studenmund <wrstuden@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: current-users
Date: 02/28/2003 16:20:16
On Fri, Feb 28, 2003 at 04:02:12PM -0800, Bill Studenmund wrote:

 > > >Ah ... is it dynamically-loading libpthread?  That does not currently
 > > >work.
 > 
 > The reason Jason thinks it doesn't work is that you've bound to a libc
 > mutex operation, which only happens if NetBSD's libpthread isn't around at
 > dynamic link time.

Right.  Those mutex routines only abort if __isthreaded is set to 1,
which happens in a contructor for the native libpthread.  If libpthread
is not present when libc binding happens, then you get the dummy routines
in libc for libc's internal thread-safeness.  Then if libpthread is dlopen'd
later, __isthreaded gets set to 1 and all hell breaks loose.

 > What MIGHT be happening is that a program's using pth, not NetBSD's
 > libpthread. That will be a problem as we have expectations of what
 > -lpthread does (overrides some weak symbols in libc) that the pth package
 > mightn't be doing.

Well, NetBSD's libpthread got invoked to set __isthreaded somehwere...

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>