tizen 2.4 release
[apps/home/settings.git] / setting-appmgr / src / setting-appmgr-async-worker.c
index f385e38..fce43e4 100644 (file)
@@ -50,23 +50,33 @@ void appmgrUg_thread_testcancel()
 
 static Eina_Bool _async_worker_idler(void *data)
 {
+       SETTING_TRACE_BEGIN;
+       SETTING_TRACE("---------------------------------------------thread join BEGIN ");
        appmgrUg_worker *worker = data;
 
        retv_if(NULL == data, ECORE_CALLBACK_CANCEL);
-
-       pthread_join(worker->tid, NULL);
+       if (worker && worker->tid) {
+               pthread_join(worker->tid, NULL);
+       }
        worker->alive = FALSE;
 
        if (worker->cb)
                worker->cb(worker->fn_ret, worker->ad);
 
-       g_hash_table_remove(async_worker_hashT, worker);
+       /*g_hash_table_remove(async_worker_hashT, worker); */
+
 
+       /*      worker->worker_idler = ecore_idler_add(_async_worker_idler, worker); */
+
+       worker->worker_idler = NULL;
+       SETTING_TRACE("---------------------------------------------thread join END ");
+       SETTING_TRACE_END;
        return ECORE_CALLBACK_CANCEL;
 }
 
 static void *_async_worker_thread(void *data)
 {
+       SETTING_TRACE(" --------------------------- thread worker : BEGIN ");
        int ret;
        appmgrUg_worker *worker = data;
 
@@ -83,7 +93,16 @@ static void *_async_worker_thread(void *data)
        APPMGRUG_STOP_POINT;
 
        worker->worker_idler = ecore_idler_add(_async_worker_idler, worker);
+       if (worker->worker_idler == NULL) {
+               SETTING_TRACE_ERROR("worker->worker_idler == NULL");
+               //worker->alive = FALSE;
+               /*----------------------------------- */
+               /* work around */
+               /*----------------------------------- */
+       //      _async_worker_idler(worker);
+       }
 
+       SETTING_TRACE(" --------------------------- thread worker : END ");
        pthread_exit(NULL);
 }
 
@@ -96,9 +115,10 @@ static void _async_worker_hash_free_key(gpointer data)
                pthread_join(worker->tid, NULL);
        }
 
-       if (worker->worker_idler)
+       if (worker->worker_idler) {
                ecore_idler_del(worker->worker_idler);
-
+               worker->worker_idler = NULL;
+       }
        free(worker);
 }