From a6ada7a1b40a5cd1f1f566378b47f75f6fa8b85e Mon Sep 17 00:00:00 2001 From: Moritz Bitsch Date: Mon, 6 Aug 2018 13:15:50 +0200 Subject: [PATCH] use channels to syncronize GAsync callbacks channels are more idiomatic --- coio_glib.c | 6 +++--- coio_glib.h | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/coio_glib.c b/coio_glib.c index 7a0d2ec..6bc8905 100644 --- a/coio_glib.c +++ b/coio_glib.c @@ -138,7 +138,7 @@ gboolean coio_task_wakeup_helper(gpointer task) void coio_gasyncresult_wakeup_helper(GObject *source_object, GAsyncResult *res, gpointer user_data) { (void)source_object; - CoioGAsyncResultHelper* helper = (CoioGAsyncResultHelper*)user_data; - helper->res = g_object_ref(res); - coio_ready(helper->task); + CoioChannel* ch = (CoioChannel*)user_data; + + coio_channbsendp(ch, g_object_ref(res)); } diff --git a/coio_glib.h b/coio_glib.h index 8cc7f3e..66ae894 100644 --- a/coio_glib.h +++ b/coio_glib.h @@ -21,11 +21,6 @@ #include #include "coio.h" -typedef struct async_helper { - CoioTask* task; - GAsyncResult* res; -} CoioGAsyncResultHelper; - GSource* coio_gsource_create(); gboolean coio_task_wakeup_helper(gpointer task); void coio_gasyncresult_wakeup_helper(GObject *source_object, GAsyncResult *res, gpointer user_data);