Change to call ecore_thread_run to ecore_main_loop_thread_safe_call
[platform/core/uifw/tts.git] / client / tts.c
index 8125e80..50b2e59 100644 (file)
@@ -278,6 +278,8 @@ static int __pkgmgr_status_cb(uid_t target_uid, int req_id, const char *type, co
 
 static void __create_pkgmgr_thread(void* data, Ecore_Thread* thread)
 {
+       SLOG(LOG_ERROR, TAG_TTSC, "[DEBUG] create pkgmgr thread");
+
        while (!g_pkgmgr) {
                g_pkgmgr = pkgmgr_client_new(PC_LISTENING);
                if (NULL == g_pkgmgr) {
@@ -303,6 +305,15 @@ static void __finish_pkgmgr_thread(void* data, Ecore_Thread* thread)
        SLOG(LOG_ERROR, TAG_TTSC, "[DEBUG] Finish pkgmgr thread");
 }
 
+static void __pkgmgr_thread(void* data)
+{
+       SLOG(LOG_ERROR, TAG_TTSC, "[DEBUG] call pkgmgr_thread");
+
+       ecore_thread_run(__create_pkgmgr_thread, __finish_pkgmgr_thread, NULL, NULL);
+
+       return ;
+}
+
 int tts_create(tts_h* tts)
 {
        if (0 != __tts_get_feature_enabled()) {
@@ -350,9 +361,9 @@ int tts_create(tts_h* tts)
                return __tts_convert_config_error_code(ret);
        }
 
-       ecore_thread_main_loop_begin();
-       ecore_thread_run(__create_pkgmgr_thread, __finish_pkgmgr_thread, NULL, NULL);
-       ecore_thread_main_loop_end();
+       ecore_main_loop_thread_safe_call_async(__pkgmgr_thread, NULL);
+
+       SLOG(LOG_INFO, TAG_TTSC, "[INFO] call ecore thread for creating pkgmgr thread");
 
        g_engine_name = vconf_get_str(TTS_ENGINE_DB_DEFAULT);
        if (NULL == g_engine_name) {