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]

[gcj-eclipse-merge-branch] make park/unpark stuff build on win32



ok to commit?

  - a


2006-12-04  Adam Megacz <megacz@cs.berkeley.edu>

        * libjava/java/lang/natThread.cc (initialize_native): remove
        pthreads-specific calls to pthread_{mutex|cond}_{initdestroy}();
        invoked by the call to _Jv_Thread{Init|Destroy}Data().
        * libjava/include/win32-threads.h: add _Jv_Thread{Unpark|Park}(),
        add _Jv_Park_{Cond|Mutex}_t
        * libjava/include/posix-threads.h: add _Jv_Park_{Cond|Mutex}_t
        * libjava/include/jvm.h (natThread): change pthread_{mutex|cond}_t
        to _Jv_Park_{Mutex|Cond}_t

Index: java/lang/natThread.cc
===================================================================
--- java/lang/natThread.cc      (revision 119526)
+++ java/lang/natThread.cc      (working copy)
@@ -54,9 +54,6 @@
   _Jv_MutexInit (&nt->join_mutex);
   _Jv_CondInit (&nt->join_cond);
 
-  pthread_mutex_init (&nt->park_mutex, NULL);
-  pthread_cond_init (&nt->park_cond, NULL);
-
   nt->thread = _Jv_ThreadInitData (this);
   // FIXME: if JNI_ENV is set we will want to free it.  It is
   // malloc()d.
@@ -75,9 +72,6 @@
   _Jv_MutexDestroy (&nt->join_mutex);
 #endif
   _Jv_FreeJNIEnv((JNIEnv*)nt->jni_env);
-
-  pthread_mutex_destroy (&nt->park_mutex);
-  pthread_cond_destroy (&nt->park_cond);
 }
 
 jint
Index: include/win32-threads.h
===================================================================
--- include/win32-threads.h     (revision 119526)
+++ include/win32-threads.h     (working copy)
@@ -47,6 +47,12 @@
 
 } _Jv_Mutex_t;
 
+// placeholder
+typedef void* _Jv_Park_Mutex_t;
+
+// placeholder
+typedef void* _Jv_Park_Cond_t;
+
 typedef struct _Jv_Thread_t
 {
   int flags;            // Flags are defined in implementation.
@@ -175,6 +181,9 @@
 void _Jv_ThreadWait (void);
 void _Jv_ThreadInterrupt (_Jv_Thread_t *data);
 
+void _Jv_ThreadUnpark (::java::lang::Thread *thread);
+void _Jv_ThreadPark (jboolean isAbsolute, jlong time);
+
 //
 // Thread interruption support
 //
Index: include/posix-threads.h
===================================================================
--- include/posix-threads.h     (revision 119526)
+++ include/posix-threads.h     (working copy)
@@ -46,6 +46,8 @@
 } _Jv_Thread_t;
 
 typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
+typedef pthread_mutex_t _Jv_Park_Mutex_t;
+typedef pthread_cond_t _Jv_Park_Cond_t;
 
 // Condition Variables used to implement wait/notify/sleep/interrupt.
 typedef struct
Index: include/jvm.h
===================================================================
--- include/jvm.h       (revision 119526)
+++ include/jvm.h       (working copy)
@@ -775,9 +775,10 @@
 
   // These are used by Unsafe.park() and Unsafe.unpark().
   volatile obj_addr_t park_permit;
-  pthread_mutex_t park_mutex;
-  pthread_cond_t park_cond;
 
+  _Jv_Park_Mutex_t park_mutex;
+  _Jv_Park_Cond_t park_cond;
+
   // This is private data for the thread system layer.
   _Jv_Thread_t *thread;
 

-- 
PGP/GPG: 5C9F F366 C9CF 2145 E770  B1B8 EFB1 462D A146 C380


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