static int g_engine_update_status = 0;
static pthread_mutex_t g_pkgmgr_mutex = PTHREAD_MUTEX_INITIALIZER;
static Ecore_Thread* g_pkgmgr_thread = NULL;
+static volatile bool g_is_finished_pkgmgr_thread = false;
static bool __is_engine_launched(const char* appid);
/* Function definition */
{
SLOG(LOG_ERROR, TAG_TTSC, "[DEBUG] create pkgmgr thread");
+ g_is_finished_pkgmgr_thread = false;
+
tts_h tts = (tts_h)data;
tts_client_s* client = tts_client_get(tts);
/* check handle */
if (NULL == client) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] client is null");
+ g_is_finished_pkgmgr_thread = true;
return ;
}
}
pthread_mutex_unlock(&g_pkgmgr_mutex);
+ g_is_finished_pkgmgr_thread = true;
+ SLOG(LOG_ERROR, TAG_TTSC, "[INFO] Finish pkgmgr_thread. func_end will be invoked in main thread.");
+
return ;
}
__tts_unset_all_callbacks(tts);
/* Cancel and Check threads */
- if (NULL != g_pkgmgr_thread && false == ecore_thread_check(g_pkgmgr_thread)) {
- SLOG(LOG_INFO, TAG_TTSC, "[INFO] Cancel pkgmgr thread");
+ if (NULL != g_pkgmgr_thread && false == ecore_thread_check(g_pkgmgr_thread) && false == g_is_finished_pkgmgr_thread) {
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] pkgmgr thread is not finished. Cancel pkgmgr thread");
ecore_thread_cancel(g_pkgmgr_thread);
}
if (NULL != client->thread && false == ecore_thread_check(client->thread)) {