use channels to syncronize GAsync callbacks

channels are more idiomatic
This commit is contained in:
Moritz Bitsch 2018-08-06 13:15:50 +02:00
parent 16e396efc3
commit a6ada7a1b4
2 changed files with 3 additions and 8 deletions

View file

@ -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 coio_gasyncresult_wakeup_helper(GObject *source_object, GAsyncResult *res, gpointer user_data)
{ {
(void)source_object; (void)source_object;
CoioGAsyncResultHelper* helper = (CoioGAsyncResultHelper*)user_data; CoioChannel* ch = (CoioChannel*)user_data;
helper->res = g_object_ref(res);
coio_ready(helper->task); coio_channbsendp(ch, g_object_ref(res));
} }

View file

@ -21,11 +21,6 @@
#include <gio/gio.h> #include <gio/gio.h>
#include "coio.h" #include "coio.h"
typedef struct async_helper {
CoioTask* task;
GAsyncResult* res;
} CoioGAsyncResultHelper;
GSource* coio_gsource_create(); GSource* coio_gsource_create();
gboolean coio_task_wakeup_helper(gpointer task); gboolean coio_task_wakeup_helper(gpointer task);
void coio_gasyncresult_wakeup_helper(GObject *source_object, GAsyncResult *res, gpointer user_data); void coio_gasyncresult_wakeup_helper(GObject *source_object, GAsyncResult *res, gpointer user_data);