Subject: Re: Threading problems
To: Nathan J. Williams <firstname.lastname@example.org>
From: Arto Huusko <email@example.com>
Date: 11/25/2004 08:29:06
On Wed, 24 Nov 2004, Nathan J. Williams wrote:
> > Why only pthread_create()? I mean, how can a module be written
> > so that it can satisfy thread-safety in the presence of a
> > threaded app, without the module directly using pthread functions
> > such as mutexes etc.
> The trick is to call a function which is a no-op when libpthread isn't
> linked in, but is the appropriate mutex operatoin when it is (if the
> program isn't actually threaded, then you don't have any thread
> concurrency issues, and thus no-ops are safe). Libc manages this with
> a set of aliases that have default, no-op implementations in libc but
> that are overridden when libpthread is linked in. The proposal is to
> make this libc trick extend to all pthread-using apps.
OK, but I wonder whether this is portable? Can I stop linking
my module against pthread on all operating systems and
architectures which correctly otherwise support pthread, and expect
things then to magically work...
or is this discussion only about a NetBSD-specific ... hack ...
to make pkgsrc and friends to work?