From: Saurav Babu Date: Wed, 6 Jan 2016 10:06:05 +0000 (+0530) Subject: [wifi] Modified logic so that callback is sent to their respective thread X-Git-Tag: accepted/tizen/ivi/20160218.023327~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=ea2c78cbe73951d104f43beb1ca260479e2822dd;p=platform%2Fcore%2Fapi%2Fwifi.git [wifi] Modified logic so that callback is sent to their respective thread Currently for sending few callbacks to application g_idle_add_full() is used. g_idle_add_full() adds the callback in global main context of the application and not the context in which thread was operating. See description at https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-idle-add-full This patch modifies the logic to create a g_idle_source_new() and then attach this source to the thread's context rather than global main context of application. Change-Id: If9a52eff79a9684edf572e6707372f630f3cac61 Signed-off-by: Saurav Babu --- diff --git a/src/libnetwork.c b/src/libnetwork.c index 1118035..b4b0c63 100755 --- a/src/libnetwork.c +++ b/src/libnetwork.c @@ -1287,6 +1287,8 @@ guint _wifi_callback_add(GSourceFunc func, gpointer user_data) { guint id; struct managed_idle_data *data; + GMainContext *context; + GSource *src; if (!func) return 0; @@ -1298,8 +1300,12 @@ guint _wifi_callback_add(GSourceFunc func, gpointer user_data) data->func = func; data->user_data = user_data; - id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, __wifi_idle_cb, data, - __wifi_idle_destroy_cb); + context = g_main_context_get_thread_default(); + src = g_idle_source_new(); + g_source_set_callback(src, __wifi_idle_cb, data, __wifi_idle_destroy_cb); + id = g_source_attach(src, context); + g_source_unref(src); + if (!id) { g_free(data); return id;