commit 4a450b5217e9c7c67d48057235c8086eaacf7578 Author: Nathaniel McCallum npmccallum@redhat.com Date: Wed Aug 10 12:03:17 2011 -0400
[glib] make verto_break() work even when the loop isn't running
src/verto-glib.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) --- diff --git a/src/verto-glib.c b/src/verto-glib.c index 7eedc1a..bb05dcc 100644 --- a/src/verto-glib.c +++ b/src/verto-glib.c @@ -100,10 +100,22 @@ glib_ctx_run_once(void *lp) g_main_context_iteration(((glib_ev_ctx*) lp)->context, TRUE); }
+static gboolean +break_callback(gpointer loop) +{ + g_main_loop_quit(loop); + return FALSE; +} + static void glib_ctx_break(void *lp) { - g_main_loop_quit(((glib_ev_ctx*) lp)->loop); + GSource *src = g_timeout_source_new(0); + g_assert(src); + g_source_set_callback(src, break_callback, ((glib_ev_ctx*) lp)->loop, NULL); + g_source_set_priority(src, G_PRIORITY_HIGH); + g_assert(g_source_attach(src, ((glib_ev_ctx*) lp)->context) != 0); + g_source_unref(src); }
static gboolean
libverto-commits@lists.fedorahosted.org