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: I5b9b927760ab2281cfd3878a3c7583bc4a00e74f
Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
{
guint id;
struct managed_idle_data *data;
+ GMainContext *context;
+ GSource *src;
if (!func)
return 0;
data->func = func;
data->user_data = user_data;
- id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, __connection_idle_cb, data,
- __connection_idle_destroy_cb);
+ context = g_main_context_get_thread_default();
+ src = g_idle_source_new();
+ g_source_set_callback(src, __connection_idle_cb, data,
+ __connection_idle_destroy_cb);
+ id = g_source_attach(src, context);
+ g_source_unref(src);
if (!id) {
g_free(data);
return id;