libgcj and the NPTL posix threads implementation

Anthony Green green@redhat.com
Mon Mar 1 05:49:00 GMT 2004


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.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /