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]

[patch] glib thread initialization


Hi,

I committed the attached patch to mainline (a while ago) and
gcc-4_0-branch (today).  See:

http://lists.gnu.org/archive/html/classpath-patches/2005-04/msg00213.html

Tom

2005-05-05  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
	(init_glib_threads): Check if threading system is already
	initialized.

Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c,v
retrieving revision 1.5
diff -u -u -r1.5 gnu_java_awt_peer_gtk_GtkToolkit.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c	22 Feb 2005 06:13:03 -0000	1.5
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c	28 Apr 2005 01:57:30 -0000
@@ -275,10 +275,22 @@
     }
   
   (*env)->GetJavaVM( env, &the_vm );
-  if (portableNativeSync)
-    g_thread_init ( &portable_native_sync_jni_functions );
+  if (!g_thread_supported ())
+    {
+      if (portableNativeSync)
+        g_thread_init ( &portable_native_sync_jni_functions );
+      else
+        g_thread_init ( NULL );
+    }
   else
-    g_thread_init ( NULL );
+    {
+      /* Warn if portable native sync is desired but the threading
+         system is already initialized.  In that case we can't
+         override the threading implementation with our portable
+         native sync functions. */
+      if (portableNativeSync)
+        g_printerr ("peer warning: portable native sync disabled.\n");
+    }
 
   /* Debugging progress message; uncomment if needed: */
   /*   printf("called gthread init\n"); */

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