Subject: Re: Threading problems
To: Nathan J. Williams <nathanw@wasabisystems.com>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: tech-pkg
Date: 11/23/2004 21:57:06
Nathan J. Williams wrote:
> jdolecek@NetBSD.org (Jaromir Dolecek) writes:
> 
> > 
> > Yeah, the libpthread lossage is becoming quite a big problem. Is there
> > no way to avoid the crash when loading threaded object module
> > to non-threaded application? We urgently need to come up with
> > pkgsrc solution for this.
> 
> The crash is intentional; the alternative is to have things break in
> more subtle ways, such as not having mutexes protecting stdio or malloc.

But you don't need mutexes protecting stdio if the program
is not threaded. Many pkgsrc libraries only use libpthread to be
thread-safe (i.e. mutexes only), and not use actual threads per-se.
This is the case e.g. for GD.

At least one library picks up libpthread without actually using
any of it's functionality (databases/unixodbc).

> I'm trying to figure out why this seems to be so much more of a
> problem for us, when as far as I know dynamically loading libpthread
> only works on AIX. Is it just that we're complaining about the failure
> rather than just letting things break strangely?

Apparently :/

Would it be difficult to abort the process only once the app actually
uses pthread_create() after loading the pthread-linked extension? 

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
-=- We can walk our road together if our goals are all the same;     -=-
-=- We can run alone and free if we pursue a different aim.          -=-