data_control_provider_handler dcp;
GList* clients;
GRecMutex mutex;
+ GMainContext *thread_default_context;
} launch_context;
static launch_context __context;
return G_SOURCE_REMOVE;
}
+static guint __g_idle_add_full(gint priority, GSourceFunc func, gpointer data)
+{
+ GSource *source;
+ guint tag;
+
+ source = g_idle_source_new();
+ if (!source)
+ return 0;
+
+ g_source_set_callback(source, (GSourceFunc)func, data, NULL);
+ g_source_set_priority(source, priority);
+ tag = g_source_attach(source, __context.thread_default_context);
+ g_source_unref(source);
+
+ return tag;
+}
+
static void __process_app_pkt(app_pkt_t *pkt, int clifd)
{
struct aul_request_s *req;
return;
}
- g_idle_add(__dispatch_request, req);
+ __g_idle_add_full(G_PRIORITY_DEFAULT, __dispatch_request, req);
}
static bool __received_event_cb(int fd, int condition, void *user_data)
__context.worker = NULL;
}
+ if (__context.thread_default_context) {
+ g_main_context_unref(__context.thread_default_context);
+ __context.thread_default_context = NULL;
+ }
+
g_rec_mutex_lock(&__context.mutex);
if (__context.clients) {
g_list_free_full(__context.clients, __destroy_client_channel);
g_rec_mutex_init(&__context.mutex);
+ __context.thread_default_context = g_main_context_ref_thread_default();
+
__context.worker = aul_worker_create("aul+");
if (!__context.worker) {
__finalize_context();
if (!b)
_E("Bundle is nullptr");
- if (!g_idle_add_full(G_PRIORITY_HIGH, __app_start_cb, b, NULL)) {
+ if (!__g_idle_add_full(G_PRIORITY_HIGH, __app_start_cb, b)) {
_E("Failed to add idler");
return AUL_R_ERROR;
}
if (!b)
_E("Bundle is nullptr");
- if (!g_idle_add(__app_start_cb, b)) {
+ if (!__g_idle_add_full(G_PRIORITY_DEFAULT, __app_start_cb, b)) {
_E("Failed to add idler");
return AUL_R_ERROR;
}