Date: Thu, 8 May 2003 09:14:37 +0800 From: "David Xu" <davidxu@freebsd.org> To: "Daniel Eischen" <eischen@pcnet1.pcnet.com> Cc: freebsd-threads@freebsd.org Subject: Re: libpthread_init Message-ID: <005d01c314ff$32b737b0$f001a8c0@davidw2k> References: <Pine.GSO.4.10.10305072058110.2395-100000@pcnet1.pcnet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
----- Original Message -----=20 From: "Daniel Eischen" <eischen@pcnet1.pcnet.com> To: "David Xu" <davidxu@viatech.com.cn> Cc: <freebsd-threads@freebsd.org> Sent: Thursday, May 08, 2003 9:05 AM Subject: Re: libpthread_init > On Thu, 8 May 2003, David Xu wrote: >=20 > > CCed freebsd-threads@freebsd.org > >=20 > > ----- Original Message -----=20 > > From: "Daniel Eischen" <eischen@pcnet1.pcnet.com> > > To: "David Xu" <davidxu@freebsd.org> > > Sent: Wednesday, May 07, 2003 8:22 PM > > Subject: Re: libpthread_init > >=20 > >=20 > > > 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 > >=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? >=20 > I know. I brought this up years ago, but didn't really > know how to fix it. >=20 > > 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, >=20 > I know, I know :-) You're preaching to the choir! (I agree) >=20 > > 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 > Yes. Have you tried it to see if it works? The other thread > libraries would also need to be updated. We should use a common > symbol like __thread_init() or __libc_thread_init() so they can > all override the same symbol. >=20 This is what I want to see, neat code. :-) I will try to see if I can work out a patch. > --=20 > Dan Eischen >=20 > _______________________________________________ > freebsd-threads@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to = "freebsd-threads-unsubscribe@freebsd.org" >=20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?005d01c314ff$32b737b0$f001a8c0>