Subject: Re: pthread + pkgsrc proposal
To: grant beattie <grant@NetBSD.org>
From: Johnny C. Lam <jlam@buildlink.org>
List: tech-pkg
Date: 11/24/2004 07:35:52
On Wed, Nov 24, 2004 at 06:25:19PM +1100, grant beattie wrote:
> On Wed, Nov 24, 2004 at 07:01:37AM +0000, Johnny C. Lam wrote:
> 
> > For pkgsrc, I will be making changes so that if the package uses 
> > dlopen(), then it will be automatically linked with pthread support. 
> > This follows the suggestion mentioned on tech-kern:
> > 
> >      http://mail-index.netbsd.org/tech-kern/2004/11/23/0014.html
> > 
> > The precise description of what will happen is that a package should
> > include dlopen.buildlink3.mk in the package Makefile if it uses dlopen().
> > If there are native pthreads available, then the package will be
> > automatically built and linked with -pthread/-lpthread/-lc_r (depending
> > on the OS; gory details in pkgsrc/mk/pthread.{buildlink3,builtin}.mk).
> > On platforms that do not have native pthreads, pkgsrc can be forced
> > to follow this same behavior by setting DLOPEN_REQUIRE_PTHREADS=yes
> > in /etc/mk.conf.
> 
> is this mutex locking behaviour true on systems other than NetBSD?
> specifically those which have had pthreads for a lot longer than
> NetBSD?
> 
> from a quick search, it sounds a lot like NetBSD is on its own in
> this particular mode of behaviour. maybe that needs to be fixed, but
> that is out of my area of expertise...

The benefit of having something like dlopen.buildlink3.mk is that as
we discover that certain platforms don't need dlopen() to imply linking
with pthreads, we can default _DLOPEN_REQUIRE_PTHREADS to "no" on those
platforms, and all of those packages that use dlopen() will be
automatically fixed for that platform.

	Cheers,

	-- Johnny Lam <jlam@buildlink.org>