libpthread_init
David Xu
davidxu at freebsd.org
Wed May 7 16:34:50 PDT 2003
CCed freebsd-threads at freebsd.org
----- Original Message -----
From: "Daniel Eischen" <eischen at pcnet1.pcnet.com>
To: "David Xu" <davidxu at freebsd.org>
Sent: Wednesday, May 07, 2003 8:22 PM
Subject: Re: libpthread_init
> On Wed, 7 May 2003, David Xu wrote:
>
> > Is it possible to call libpthread_init in libc at
> > startup to initialize libpthread for static linked
> > binary?
> > 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?
>
> I don't know. It would be nice to get rid of all the
> calls to lipbthread_init() in libpthread.
>
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.
> --
> Dan Eischen
>
>
More information about the freebsd-threads
mailing list