X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fglk.c;h=b86daed07971769f49f861c460f4ea8836b79258;hb=e4a75256e901a89729c48fcc2f9229cd0cfe9124;hp=58b9c00e73cf11cd73ef8606a714607948d1409f;hpb=1589fbfcd406df40d8da4f078dad3327c4862871;p=projects%2Fchimara%2Fchimara.git diff --git a/libchimara/glk.c b/libchimara/glk.c index 58b9c00..b86daed 100644 --- a/libchimara/glk.c +++ b/libchimara/glk.c @@ -74,15 +74,15 @@ glk_exit(void) 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"); @@ -100,8 +100,10 @@ glk_exit(void) * all. So you can call it often. * * - * 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. * * * glk_tick() does not try to update the screen, or check for player input, or @@ -122,8 +124,8 @@ glk_exit(void) * loop, this is critical. In a C program, you can often eyeball it. * * But the next version of model.c will have a - * glk_tick() in the ornate printing loop of verb_yada(). - * Just to make the point. + * glk_tick() in the ornate printing loop of + * verb_yada(). Just to make the point. * * */