From: Philip Chimento Date: Sat, 31 Aug 2013 22:04:59 +0000 (-0700) Subject: Don't use g_thread_init() anymore X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=a03ca60f975be1f4636e42ca19f9e6eafc3fad12;p=projects%2Fchimara%2Fchimara.git Don't use g_thread_init() anymore g_thread_init() is called automatically when the library loads. --- diff --git a/libchimara/chimara-glk.c b/libchimara/chimara-glk.c index a350c5a..540639a 100644 --- a/libchimara/chimara-glk.c +++ b/libchimara/chimara-glk.c @@ -51,18 +51,12 @@ * url="http://www.gnu.org/software/libtool/manual/html_node/Finding-the-dlname.html"> * Libtool manual). * - * 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 before 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, + * before 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); * diff --git a/libchimara/init.c b/libchimara/init.c index ab7522c..0145920 100644 --- a/libchimara/init.c +++ b/libchimara/init.c @@ -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; diff --git a/player/main.c b/player/main.c index b919203..a4739f7 100644 --- a/player/main.c +++ b/player/main.c @@ -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); diff --git a/tests/glulxercise.c b/tests/glulxercise.c index fc9a9b1..b323dd9 100644 --- a/tests/glulxercise.c +++ b/tests/glulxercise.c @@ -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); diff --git a/tests/plugin-loader.c b/tests/plugin-loader.c index 24a9889..296a58f 100644 --- a/tests/plugin-loader.c +++ b/tests/plugin-loader.c @@ -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); diff --git a/tests/test-close.c b/tests/test-close.c index 68ea15f..1e0266e 100644 --- a/tests/test-close.c +++ b/tests/test-close.c @@ -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); diff --git a/tests/test-multisession.c b/tests/test-multisession.c index e0de9a1..57c67ab 100644 --- a/tests/test-multisession.c +++ b/tests/test-multisession.c @@ -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);