static char* g_engine_name = NULL;
static int g_engine_update_status = 0;
+static volatile bool g_is_engine_name_changed = false;
static Ecore_Thread* g_reprepare_thread = NULL;
static int __update_engine_name()
{
- if (g_engine_name) {
- free(g_engine_name);
- g_engine_name = NULL;
- }
-
- g_engine_name = vconf_get_str(TTS_ENGINE_DB_DEFAULT);
- if (NULL == g_engine_name) {
+ char* new_engine_name = vconf_get_str(TTS_ENGINE_DB_DEFAULT);
+ if (NULL == new_engine_name) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to get engine name");
return TTS_ERROR_OPERATION_FAILED;
}
+ if (NULL != g_engine_name && 0 == strncmp(g_engine_name, new_engine_name, TTS_ENGINE_APPID_LEN)) {
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] engine name is same");
+ free(new_engine_name);
+ return TTS_ERROR_NONE;
+ }
+
+ free(g_engine_name);
+ g_engine_name = new_engine_name;
+ g_is_engine_name_changed = true;
+
SLOG(LOG_ERROR, TAG_TTSC, "[INFO] Engine name(%s)", g_engine_name);
return TTS_ERROR_NONE;
}
{
SLOG(LOG_INFO, TAG_TTSC, "[DEBUG] start reprepare thread. engine update status(%d)", g_engine_update_status);
+ if (0 == g_engine_update_status && g_is_engine_name_changed) {
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] Reprepare by engine change");
+ return;
+ }
+
int cnt = 0;
while (!g_engine_update_status && cnt < 20) {
SLOG(LOG_WARN, TAG_TTSC, "[WARNING] wait for starting update");
}
g_list_free(clients);
+ g_is_engine_name_changed = false;
g_reprepare_thread = NULL;
}
static void __cancel_reprepare_thread(void* data, Ecore_Thread* thread)
{
SLOG(LOG_INFO, TAG_TTSC, "[INFO] cancel reprepare thread");
+ g_is_engine_name_changed = false;
g_reprepare_thread = NULL;
}
if (0 != __update_engine_name()) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to set engine name into core module");
}
+ g_is_engine_name_changed = false;
/* Register vconfkey callback to detect engine change */
vconf_notify_key_changed(TTS_ENGINE_DB_DEFAULT, __engine_changed_cb, NULL);