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: Anthony Green <green at redhat dot com>
- To: "Boehm, Hans" <hans dot boehm at hp dot com>
- Cc: "'Michael Koch'" <konqueror at gmx dot de>, java at gcc dot gnu dot org
- Date: Sun, 29 Feb 2004 21:48:42 -0800
- Subject: RE: libgcj and the NPTL posix threads implementation
- Organization: Red Hat, Inc.
- References: <0C3EFB691636964BBF914AE56AE83A89501F95@hplex4.hpl.hp.com>
On Fri, 2004-02-27 at 09:23, Boehm, Hans wrote:
> I'm not quite sure what the best replacement is, though. You were suggesting
> just using the segment register directly?
I've been experimenting with the following patch, and it appears to work
just fine. The only problem right now is that I'm not sure how to test
whether or not this is safe to use.
Any suggestions out there?
AG
Index: libjava/include/posix-threads.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/posix-threads.h,v
retrieving revision 1.25
diff -c -p -r1.25 posix-threads.h
*** libjava/include/posix-threads.h 21 Oct 2003 04:46:19 -0000 1.25
--- libjava/include/posix-threads.h 1 Mar 2004 05:45:19 -0000
*************** _Jv_ThreadCurrent (void)
*** 218,223 ****
--- 218,240 ----
// to threads.
+ #ifdef __i386__
+
+ typedef size_t _Jv_ThreadId_t;
+
+ inline _Jv_ThreadId_t
+ _Jv_ThreadSelf (void)
+ {
+ size_t id;
+ asm ("mov %%gs:0x8, %0" : "=r"(id));
+ return id;
+ }
+
+ #define JV_SELF_DEFINED
+
+ #endif /* __i386__ */
+
+
#ifdef __ia64__
typedef size_t _Jv_ThreadId_t;
--
Anthony Green <green@redhat.com>
Red Hat, Inc.