Remove overcomplicated way to call worker callback function in appmgr 27/219727/1
authorKrzysztof Wieclaw <k.wieclaw@samsung.com>
Mon, 9 Dec 2019 11:08:16 +0000 (12:08 +0100)
committerKrzysztof Wieclaw <k.wieclaw@samsung.com>
Mon, 9 Dec 2019 11:08:16 +0000 (12:08 +0100)
Change-Id: I49111b431fe8ac27dec02be179056d2c0c93248d
Signed-off-by: Krzysztof Wieclaw <k.wieclaw@samsung.com>
setting-appmgr/src/setting-appmgr-async-worker.c

index 71fdcdcf37be47d67eb3d7c8517e167ad47baa69..45acf50050a6ca3bd84f283b07b6aa125d7c9592 100644 (file)
@@ -28,17 +28,15 @@ typedef struct {
        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);
 
@@ -48,8 +46,6 @@ static Eina_Bool _async_worker_idler(void *data)
                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)
@@ -75,22 +71,7 @@ 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;
@@ -103,10 +84,6 @@ static void _async_worker_hash_free_key(gpointer data)
        if (worker->alive)
                pthread_cancel(worker->tid);
 
-       if (worker->worker_idler) {
-               ecore_idler_del(worker->worker_idler);
-               worker->worker_idler = NULL;
-       }
        free(worker);
 }