#include <system_info.h>
#include <vconf.h>
#include <package-manager.h>
+#include <pthread.h>
#include "tts.h"
#include "tts_client.h"
static pkgmgr_client* g_pkgmgr = NULL;
static char* g_engine_name = NULL;
static int g_engine_update_status = 0;
+static pthread_mutex_t g_pkgmgr_mutex = PTHREAD_MUTEX_INITIALIZER;
+
/* Function definition */
static Eina_Bool __tts_notify_state_changed(void *data);
{
SLOG(LOG_ERROR, TAG_TTSC, "[DEBUG] create pkgmgr thread");
+ pthread_mutex_lock(&g_pkgmgr_mutex);
+
while (!g_pkgmgr) {
g_pkgmgr = pkgmgr_client_new(PC_LISTENING);
if (NULL == g_pkgmgr) {
usleep(10000);
}
+ pthread_mutex_unlock(&g_pkgmgr_mutex);
+
return ;
}
return TTS_ERROR_OPERATION_FAILED;
}
+ pthread_mutex_lock(&g_pkgmgr_mutex);
if (g_pkgmgr) {
pkgmgr_client_remove_listen_status(g_pkgmgr);
pkgmgr_client_free(g_pkgmgr);
g_pkgmgr = NULL;
}
+ pthread_mutex_unlock(&g_pkgmgr_mutex);
tts_config_mgr_finalize(client->uid);