int fn_ret;
callback_fn cb;
SettingAppMgr *ad;
-
- Ecore_Idler *worker_idler;
} appmgr_worker;
static GHashTable *async_worker_hashT = NULL;
-static Eina_Bool _async_worker_idler(void *data)
+static void _async_worker_idler(void *data)
{
appmgr_worker *worker = data;
- retv_if(NULL == data, ECORE_CALLBACK_CANCEL);
+ ret_if(NULL == data);
if (worker->tid)
pthread_join(worker->tid, NULL);
worker->cb(worker->fn_ret, worker->ad);
g_hash_table_remove(async_worker_hashT, worker);
-
- return ECORE_CALLBACK_CANCEL;
}
static void *_async_worker_thread(void *data)
worker->fn_ret = worker->fn(worker->ad);
- if (ecore_thread_main_loop_begin() < 0)
- SETTING_TRACE_ERROR("ecore_thread_main_loop_begin() failed.");
-
- worker->worker_idler = ecore_idler_add(_async_worker_idler, worker);
- if (worker->worker_idler == NULL) {
- SETTING_TRACE_ERROR("worker->worker_idler == NULL");
- abort();
- /*worker->alive = FALSE; */
- /*----------------------------------- */
- /* work around */
- /*----------------------------------- */
- /* _async_worker_idler(worker); */
- }
-
- if (ecore_thread_main_loop_end() < 0)
- SETTING_TRACE_ERROR("ecore_thread_main_loop_end() failed.");
+ ecore_main_loop_thread_safe_call_async(_async_worker_idler, worker);
pthread_exit(NULL);
return NULL;
if (worker->alive)
pthread_cancel(worker->tid);
- if (worker->worker_idler) {
- ecore_idler_del(worker->worker_idler);
- worker->worker_idler = NULL;
- }
free(worker);
}