Don't use g_thread_init() anymore
authorPhilip Chimento <philip.chimento@gmail.com>
Sat, 31 Aug 2013 22:04:59 +0000 (15:04 -0700)
committerPhilip Chimento <philip.chimento@gmail.com>
Mon, 9 Sep 2013 04:12:54 +0000 (21:12 -0700)
g_thread_init() is called automatically when the library loads.

libchimara/chimara-glk.c
libchimara/init.c
player/main.c
tests/glulxercise.c
tests/plugin-loader.c
tests/test-close.c
tests/test-multisession.c

index a350c5aa0442bd35dd5dcb9aff389fa567eedd4a..540639a066adb69a556d17259e12a1168cfdb273 100644 (file)
  * url="http://www.gnu.org/software/libtool/manual/html_node/Finding-the-dlname.html">
  * Libtool manual</ulink>).
  *
- * You need to initialize multithreading in any program you use a #ChimaraGlk
- * widget in. This means including the following incantation at the beginning
- * of your program:
- * |[
- * if(!g_thread_supported())
- *     g_thread_init(NULL);
- * gdk_threads_init();
- * ]|
- * This initialization must take place <emphasis>before</emphasis> the call to
- * gtk_init(). In addition to this, you must also protect your call to 
- * gtk_main() by calling gdk_threads_enter() right before it, and 
- * gdk_threads_leave() right after it.
+ * You need to initialize GDK threading in any program you use a #ChimaraGlk
+ * widget in.
+ * This means calling gdk_threads_init() at the beginning of your program,
+ * <emphasis>before</emphasis> the call to gtk_init().
+ * In addition to this, you must also protect your call to gtk_main() by calling
+ * gdk_threads_enter() right before it, and gdk_threads_leave() right after it.
  *
  * The following sample program shows how to initialize and construct a simple 
  * GTK window that runs a Glk program:
@@ -79,8 +73,6 @@
  *     gchar *plugin_argv[] = { "plugin.so", "-option" };
  *
  *     /<!---->* Initialize threads and GTK *<!---->/
- *     if(!g_thread_supported())
- *         g_thread_init(NULL);
  *     gdk_threads_init();
  *     gtk_init(&argc, &argv);
  *     
index ab7522cbc545d6240ea578f2a1963796fcb4200d..0145920b80f39ecce41317a7c1759668a4de3a4b 100644 (file)
@@ -8,7 +8,7 @@
 static gboolean chimara_initialized = FALSE;
 
 /* This function is called at every entry point of the library, to set up
-threads and gettext. It is NOT called from Glk functions. */
+gettext and GStreamer. It is NOT called from Glk functions. */
 void
 chimara_init(void)
 {
@@ -17,13 +17,6 @@ chimara_init(void)
                /* Setup gettext */
                bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
                bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
-               
-               /* Make sure threads have been initialized */
-               if(!g_thread_supported())
-                       g_error(_("In order to use the Chimara library, you must initialize"
-                               " the thread system by calling g_threads_init() and "
-                               "gdk_threads_init() BEFORE the initial call to gtk_init() in "
-                               "your main program."));
 
 #ifdef GSTREAMER_SOUND
                /* Make sure GStreamer has been initialized if it hasn't been already;
index b919203cae0aaf2dca1768a2faf203ab5b2b07f4..a4739f79f8ebd2d31d017690a4b612ddad486c53 100644 (file)
@@ -209,8 +209,6 @@ main(int argc, char *argv[])
        textdomain(GETTEXT_PACKAGE);
 #endif
 
-       if( !g_thread_supported() )
-               g_thread_init(NULL);
        gdk_threads_init();
        gtk_init(&argc, &argv);
 
index fc9a9b1c93d49f7021f71f2bf74f632d90ca24c7..b323dd9e5438030d41bf30fde334798b6a71c143 100644 (file)
@@ -76,8 +76,6 @@ main(int argc, char *argv[])
 {
        GError *error = NULL;
 
-       if( !g_thread_supported() )
-               g_thread_init(NULL);
        gdk_threads_init();
        gtk_init(&argc, &argv);
 
index 24a98890433759e2a69a6dfe660866e093adecb3..296a58f658ce5f741fbc1e9a4bf4f8d7abc40f29 100644 (file)
@@ -88,8 +88,6 @@ main(int argc, char *argv[])
        textdomain(GETTEXT_PACKAGE);
 #endif
 
-       if( !g_thread_supported() )
-               g_thread_init(NULL);
        gdk_threads_init();
        gtk_init(&argc, &argv);
 
index 68ea15f1a9bf8487cf2bc7ea12f4fc07ae3f8077..1e0266ead638bac6bf79d468a48f194ff035c0dc 100644 (file)
@@ -33,8 +33,6 @@ main(int argc, char *argv[])
     GtkWidget *window, *vbox, *hbox, *stop, *go, *glk;
 
     /* Initialize threads and GTK */
-    if(!g_thread_supported())
-        g_thread_init(NULL);
     gdk_threads_init();
     gtk_init(&argc, &argv);
     
index e0de9a16faef99814bb4cfad65bd3d17e0fed21c..57c67ab65fb08e9449d17bf2cd5d72d5f7729eb5 100644 (file)
@@ -27,8 +27,6 @@ on_delete_event(void)
 int
 main(int argc, char **argv)
 {
-       if( !g_thread_supported() )
-               g_thread_init(NULL);
        gdk_threads_init();
        gtk_init(&argc, &argv);