X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fchimara-glk.c;h=540639a066adb69a556d17259e12a1168cfdb273;hb=a03ca60f975be1f4636e42ca19f9e6eafc3fad12;hp=337cfa5fce112326e50b4349b0b696c8bb050b6e;hpb=e4a75256e901a89729c48fcc2f9229cd0cfe9124;p=projects%2Fchimara%2Fchimara.git
diff --git a/libchimara/chimara-glk.c b/libchimara/chimara-glk.c
index 337cfa5..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);
*
@@ -1128,8 +1120,8 @@ glk_main() runs. Takes ownership of @startup and will free it. */
static gpointer
glk_enter(struct StartupData *startup)
{
- extern GPrivate *glk_data_key;
- g_private_set(glk_data_key, startup->glk_data);
+ extern GPrivate glk_data_key;
+ g_private_set(&glk_data_key, startup->glk_data);
/* Acquire the Glk thread's references to the input queues */
g_async_queue_ref(startup->glk_data->char_input_queue);
@@ -1236,8 +1228,8 @@ chimara_glk_run(ChimaraGlk *glk, const gchar *plugin, int argc, char *argv[], GE
g_object_notify(G_OBJECT(glk), "program-name");
/* Run in a separate thread */
- priv->thread = g_thread_create((GThreadFunc)glk_enter, startup, TRUE, error);
-
+ priv->thread = g_thread_try_new("glk", (GThreadFunc)glk_enter, startup, error);
+
return !(priv->thread == NULL);
}