Subject: Re: Threading problems
To: Eric Haszlakiewicz <>
From: Bill Studenmund <>
List: tech-kern
Date: 11/24/2004 08:42:27
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Nov 24, 2004 at 02:45:11AM -0600, Eric Haszlakiewicz wrote:
> On Tue, Nov 23, 2004 at 06:59:43PM -0800, Bill Studenmund wrote:
> > Also, you're assuming that the program is fine being suddenly-threaded.=
> > Say _it_ is built different if threads are enabled or not. Adding -pthr=
> > to the command line defines "_REENTRANT", which a program certainly can=
> > use to change its behavior. Looking in stdio.h, its behavior will be=20
> > different. Some things it does will never be able to work right adding=
> > threading later.
> 	I didn't think of that.  That just about kills my idea.  oh well.

Nor had I until I was composing that EMail.

> > Given how much code really needs to be _REENTRANT or not at compile tim=
> > I don't see how we can ever make "magic add pthread later" work right. =
> > I think what we're doing now is the right thing, by making it obvious t=
> > code needs recompiling.
> 	uhm... I guess I'm not entirely up to speed on what all the requirements
> for a threaded program are.  What you're saying seems to imply that
> (going back to the original problem) the postgres binary needs to be built
> with -pthread from the very beginning if it is to dlopen a pthread-linked
> library.  It is not enough to use LD_PRELOAD.  Correct?

Yes, and so the things I was saying were wrong about LD_PRELOAD. A program=
_might_ work, but it's not guaranteed.

Take care,


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.3 (NetBSD)