This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Boehm GC support addition for debugging


Keith Seitz wrote:
This going to break non-pthreads builds. There doesn't appear to be any abstract platform-independent threading convention between the GC and gcj. The GC uses GC_thread (which is private to the GC), and gcj uses either java.lang.Thread or _Jv_Thread_t.

Would the following work? _Jv_SuspendThread would take a _Jv_ThreadDesc_t argument, and use _Jv_GetPlatformThreadID() on it. GC_suspend_thread() etc would be defined in gc.h with whatever the correct argument type is depending on the platform.


Bryce

Index: win32-threads.h
===================================================================
--- win32-threads.h	(revision 114472)
+++ win32-threads.h	(working copy)
@@ -72,6 +72,15 @@
 
 typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
 
+// Type identifying a win32 thread.
+typedef HANDLE _Jv_ThreadDesc_t;
+
+inline _Jv_ThreadDesc_t
+_Jv_GetPlatformThreadID(_Jv_Thread_t *t)
+{
+  return t->handle;
+}
+
 //
 // Condition variables.
 //
Index: posix-threads.h
===================================================================
--- posix-threads.h	(revision 114472)
+++ posix-threads.h	(working copy)
@@ -47,7 +47,6 @@
 
 typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
 
-
 // Condition Variables used to implement wait/notify/sleep/interrupt.
 typedef struct
 {
@@ -82,6 +81,15 @@
   return (mu->owner != pthread_self());
 }
 
+// Type identifying a POSIX thread.
+typedef pthread_t _Jv_ThreadDesc_t;
+
+inline _Jv_ThreadDesc_t
+_Jv_GetPlatformThreadID(_Jv_Thread_t *t)
+{
+  return t->thread;
+}
+
 //
 // Condition variables.
 //

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]