Subject: Re: libpthread
To: Paulo Alexandre Pinto Pires <p@ppires.org>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: current-users
Date: 06/22/2003 19:25:38
Paulo Alexandre Pinto Pires <p@ppires.org> writes:

> I know nothing about POSIX threads, but it would be nice, if it
> doesn't depend on too many opaque objects and types (that "expand" to
> underlying real types and objects at compile time) in its standard
> API, to have the ability to transparently switch from our native
> threads library to some other at runtime (through e.g. LD_LIBRARY_PATH
> setting), so that one can choose when he wants to debug and when he
> wants to be stable.  (Yet nice, I am not saying this is or should be
> feasible.)

The API of pthreads is such that a compile-time swap is
reasonable. However, the ABI is not; many object types have to be
exposed to the calling code (pthread_t, pthread_mutex_t,
pthread_cond_t, etc.) along with static initializer values for
those. This prevents runtime swapping of pthread libraries, since any
two pthread implementations probably don't agree on the size, layout,
and initial contents of pthread_mutex_t.

        - Nathan