Subject: Re: Threading problems
To: Jaromir Dolecek <jdolecek@NetBSD.org>
From: Nathan J. Williams <email@example.com>
Date: 11/23/2004 16:06:23
jdolecek@NetBSD.org (Jaromir Dolecek) writes:
> 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.
Right, that's what I meant by "inappropriately". If the goal is to be
a library that is safe in the presence of threaded calling code, then
linking against libpthread is the wrong answer. The right answer is to
use our <threadlib.h> routines, and let the libc weak-binding work for
you, rather than against you.
> At least one library picks up libpthread without actually using
> any of it's functionality (databases/unixodbc).
Okay, that's a bug. Why does that happen?
> Would it be difficult to abort the process only once the app actually
> uses pthread_create() after loading the pthread-linked extension?
I'm not sure that's right, either. There are still issues of data
structure consistency, since the mutex and condvar routines will
really be called.