This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
RE: libgcj and the NPTL posix threads implementation
- From: Andrew Haley <aph at redhat dot com>
- To: Anthony Green <green at redhat dot com>
- Cc: Jeff Sturm <jsturm at one-point dot com>, "Boehm, Hans" <hans dot boehm at hp dot com>, "'Michael Koch'" <konqueror at gmx dot de>, java at gcc dot gnu dot org
- Date: Mon, 1 Mar 2004 22:15:39 +0000
- Subject: RE: libgcj and the NPTL posix threads implementation
- References: <Pine.LNX.4.44.0403011639240.17464-100000@ops2.one-point.com><1078179038.3426.11.camel@escape>
Anthony Green writes:
> On Mon, 2004-03-01 at 13:42, Jeff Sturm wrote:
> > What can you reliably test for, besides catching a signal if TLS isn't
> > available?
>
> I think we'd want to do something like this for x86...
>
> static int using_NPTL = 0;
>
> ...and...
>
> #ifdef _CS_GNU_LIBPTHREAD_VERSION
> size_t n = confstr (_CS_GNU_LIBPTHREAD_VERSION, NULL, 0);
> if (n > 0)
> {
> char* buf = (char*)alloca(n);
> confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, n);
> if (strstr (buf, "NPTL"))
> using_NPTL = true;
> }
> #endif
>
> ..and..
>
> inline _Jv_ThreadId_t
> _Jv_ThreadSelf (void)
> {
> if (using_NPTL)
> {
> size_t id;
> asm ("mov %%gs:0x0, %0" : "=r"(id));
> return id;
> } else {
> ...use Boehm's caching thread identity code...
> }
> }
>
>
> I think this would always work, but I really wish we didn't have to.
It won't be so very long until all this stuff really is stable. Give
it 6 months or so.
Andrew.