From owner-freebsd-threads@FreeBSD.ORG Wed May 7 16:34:49 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C59E237B401; Wed, 7 May 2003 16:34:49 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6747443F3F; Wed, 7 May 2003 16:34:49 -0700 (PDT) (envelope-from davidxu@freebsd.org) Received: from tiger (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with SMTP id h47NYlUp029323; Wed, 7 May 2003 16:34:48 -0700 (PDT) (envelope-from davidxu@freebsd.org) Message-ID: <004301c314f1$b0b67fd0$0701a8c0@tiger> From: "David Xu" To: "Daniel Eischen" References: Date: Thu, 8 May 2003 07:37:56 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 cc: freebsd-threads@freebsd.org Subject: Re: libpthread_init X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: David Xu List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 May 2003 23:34:50 -0000 CCed freebsd-threads@freebsd.org ----- Original Message -----=20 From: "Daniel Eischen" To: "David Xu" Sent: Wednesday, May 07, 2003 8:22 PM Subject: Re: libpthread_init > On Wed, 7 May 2003, David Xu wrote: >=20 > > Is it possible to call libpthread_init in libc at > > startup to initialize libpthread for static linked > > binary?=20 > > for example, use "__attribute__((constructor))" > > or put a weak symbol in crt1.c to let libpthread > > override it, and be called in libc startup routine? >=20 > I don't know. It would be nice to get rid of all the > calls to lipbthread_init() in libpthread. >=20 I think there should be a weak symbol in crt1.c or somewhere to let static linked thread library overide it, the weak symbol will be = called at libc startup time to initialize thread library . I don't like current thread initializing mode --- it is triggered by user application, and = the initializing point is not clear, where and when is it initialized? It is error-prone mode, while mono-thread has a perfect initializing = step, why should threaded app have a bad initializing step, and we must put : "if (!__isthreaded) then do something" everywhere in thread = library, I have already found that a simple "write(1, "hello", 5)" would cause = SEGSIGV when it is linked with static pthread library. FreeBSD now has two mode = apps, mono-threaded and mutli-threaded, I think both should have a good = initializing code, both are important, libc should be refined to reflect the fact. > --=20 > Dan Eischen >=20 >=20