#include "gi_blorb.h"
#include "window.h"
-G_GNUC_INTERNAL GPrivate *glk_data_key = NULL;
+G_GNUC_INTERNAL GPrivate glk_data_key = G_PRIVATE_INIT(NULL);
/**
* glk_exit:
void
glk_exit(void)
{
- ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
+ ChimaraGlkPrivate *glk_data = g_private_get(&glk_data_key);
shutdown_glk_pre();
glk_put_string("\n");
flush_window_buffer(largewin);
}
-
- g_mutex_lock(glk_data->shutdown_lock);
+
+ g_mutex_lock(&glk_data->shutdown_lock);
for(win = glk_window_iterate(NULL, NULL); win; win = glk_window_iterate(win, NULL)) {
if(win->type == wintype_TextGrid || win->type == wintype_TextBuffer)
g_signal_handler_unblock(win->widget, win->shutdown_keypress_handler);
}
- g_cond_wait(glk_data->shutdown_key_pressed, glk_data->shutdown_lock);
- g_mutex_unlock(glk_data->shutdown_lock);
-
+ g_cond_wait(&glk_data->shutdown_key_pressed, &glk_data->shutdown_lock);
+ g_mutex_unlock(&glk_data->shutdown_lock);
+
shutdown_glk_post();
g_signal_emit_by_name(glk_data->self, "stopped");
* all. So you can call it often.
*
* <note><para>
- * In a virtual machine interpreter, once per opcode is appropriate. In a
- * program with lots of computation, pick a comparable rate.
+ * In a virtual machine interpreter, once per opcode is appropriate. A more
+ * parsimonious approach would be once per branch and function call opcode;
+ * this guarantees it will be called inside loops. In a program with lots of
+ * computation, pick a comparable rate.
* </para></note>
*
* glk_tick() does not try to update the screen, or check for player input, or