int filesize;
vc_engine_info_s* info = NULL;
+ SLOG(LOG_DEBUG, vc_config_tag(), "[CONFIG] Release engine and Unregister engine config");
+
__vc_config_release_engine();
g_engine_list = NULL;
__vc_config_mgr_unregister_engine_config_updated_event();
+ SLOG(LOG_DEBUG, vc_config_tag(), "[CONFIG] default directory : %s", VC_DEFAULT_ENGINE_INFO);
+
/* Copy default info directory to download directory */
dp = opendir(VC_DEFAULT_ENGINE_INFO);
if (NULL == dp) {
static Eina_Bool __vc_config_mgr_engine_config_inotify_event_callback(void* data, Ecore_Fd_Handler *fd_handler)
{
SLOG(LOG_DEBUG, vc_config_tag(), "@@@ Engine config updated callback event");
+ ecore_thread_main_loop_begin();
+ pthread_mutex_lock(&vc_config_mgr_mutex);
vc_engine_inotify_s *ino = (vc_engine_inotify_s *)data;
int dir_fd = ino->dir_fd;
if (0 > length) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Empty Inotify event");
SLOG(LOG_DEBUG, vc_config_tag(), "@@@");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return ECORE_CALLBACK_DONE;
}
SLOG(LOG_DEBUG, vc_config_tag(), "@@@");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return ECORE_CALLBACK_PASS_ON;
}
return 0;
}
-
-
-
-
Eina_Bool vc_config_mgr_inotify_event_cb(void* data, Ecore_Fd_Handler *fd_handler)
{
SLOG(LOG_DEBUG, vc_config_tag(), "@@@ Config changed callback event");
void __vc_config_language_changed_cb(keynode_t *key, void *data)
{
- if (true == g_config_info->auto_lang) {
+ pthread_mutex_lock(&vc_config_mgr_mutex);
+ if (g_config_info && true == g_config_info->auto_lang) {
/* Get voice input vconf key */
__vc_config_set_auto_language();
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return;
}
int* get_uid;
vc_config_client_s* temp_client = NULL;
- if (0 != pthread_mutex_init(&vc_config_mgr_mutex, NULL)) {
- SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to initialize vc_config_mgr_mutex.");
- }
-
SLOG(LOG_INFO, vc_config_tag(), "[WARNING] Enter critical section");
+ ecore_thread_main_loop_begin();
pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 < g_slist_length(g_config_client_list)) {
if (uid == *get_uid) {
SLOG(LOG_WARN, vc_config_tag(), "[CONFIG] uid(%d) has already registered", uid);
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
SLOG(LOG_DEBUG, vc_config_tag(), "[WARNING] Leave critical section");
return 0;
}
if (NULL == temp_client) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to allocate memory");
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return VC_ERROR_OUT_OF_MEMORY;
}
__vc_config_mgr_print_client_info();
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
SLOG(LOG_DEBUG, vc_config_tag(), "[WARNING] Leave critical section");
return 0;
}
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_CONFIG_BASE);
__vc_config_release_client(uid);
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return -1;
} else {
SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_CONFIG_BASE);
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_RUNTIME_INFO_ROOT);
__vc_config_release_client(uid);
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return -1;
} else {
SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_RUNTIME_INFO_ROOT);
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_DOWNLOAD_BASE);
__vc_config_release_client(uid);
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return -1;
} else {
SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_DOWNLOAD_BASE);
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_DOWNLOAD_ENGINE_INFO);
__vc_config_release_client(uid);
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return -1;
} else {
SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_DOWNLOAD_ENGINE_INFO);
__vc_config_release_client(uid);
__vc_config_release_engine();
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return VC_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
__vc_config_release_client(uid);
__vc_config_release_engine();
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return -1;
}
__vc_config_release_client(uid);
__vc_config_release_engine();
vc_parser_unload_config(g_config_info);
+ g_config_info = NULL;
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return VC_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
__vc_config_release_client(uid);
__vc_config_release_engine();
vc_parser_unload_config(g_config_info);
+ g_config_info = NULL;
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return -1;
}
__vc_config_release_client(uid);
__vc_config_release_engine();
vc_parser_unload_config(g_config_info);
+ g_config_info = NULL;
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return -1;
}
__vc_config_release_client(uid);
__vc_config_release_engine();
vc_parser_unload_config(g_config_info);
+ g_config_info = NULL;
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return VC_ERROR_OUT_OF_MEMORY;
}
__vc_config_mgr_print_client_info();
pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
SLOG(LOG_DEBUG, vc_config_tag(), "[WARNING] Leave critical section");
return 0;
}
if (0 < __vc_config_release_client(uid)) {
pthread_mutex_unlock(&vc_config_mgr_mutex);
SLOG(LOG_DEBUG, vc_config_tag(), "[WARNING] Leave critical section");
-
- if (0 != pthread_mutex_destroy(&vc_config_mgr_mutex)) {
- SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to destroy vc_config_mgr_mutex.");
- }
+
return 0;
}
__vc_config_release_engine();
-
+
vconf_ignore_key_changed(VCONFKEY_LANGSET, __vc_config_language_changed_cb);
vc_parser_unload_config(g_config_info);
+ g_config_info = NULL;
pthread_mutex_unlock(&vc_config_mgr_mutex);
SLOG(LOG_DEBUG, vc_config_tag(), "[WARNING] Leave critical section");
- if (0 != pthread_mutex_destroy(&vc_config_mgr_mutex)) {
- SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to destroy vc_config_mgr_mutex.");
- }
-
SLOG(LOG_DEBUG, vc_config_tag(), "[Success] Finalize config");
-
return 0;
}
GSList *iter = NULL;
vc_config_client_s* temp_client = NULL;
+ ecore_thread_main_loop_begin();
+ pthread_mutex_lock(&vc_config_mgr_mutex);
+
/* Call all callbacks of client*/
iter = g_slist_nth(g_config_client_list, 0);
temp_client->engine_cb = engine_cb;
if (0 != __vc_config_mgr_register_lang_event()) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to register config event");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_OPERATION_FAILED;
}
}
iter = g_slist_next(iter);
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return 0;
}
GSList *iter = NULL;
vc_config_client_s* temp_client = NULL;
+ ecore_thread_main_loop_begin();
+ pthread_mutex_lock(&vc_config_mgr_mutex);
+
/* Call all callbacks of client*/
iter = g_slist_nth(g_config_client_list, 0);
iter = g_slist_next(iter);
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return 0;
}
GSList *iter = NULL;
vc_config_client_s* temp_client = NULL;
+ ecore_thread_main_loop_begin();
+ pthread_mutex_lock(&vc_config_mgr_mutex);
+
/* Call all callbacks of client*/
iter = g_slist_nth(g_config_client_list, 0);
temp_client->lang_cb = lang_cb;
if (0 != __vc_config_mgr_register_lang_event()) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to register config event");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_OPERATION_FAILED;
}
}
iter = g_slist_next(iter);
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return 0;
}
GSList *iter = NULL;
vc_config_client_s* temp_client = NULL;
+ ecore_thread_main_loop_begin();
+ pthread_mutex_lock(&vc_config_mgr_mutex);
+
/* Call all callbacks of client*/
iter = g_slist_nth(g_config_client_list, 0);
iter = g_slist_next(iter);
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
+ ecore_thread_main_loop_end();
return 0;
}
GSList *iter = NULL;
vc_config_client_s* temp_client = NULL;
+ pthread_mutex_lock(&vc_config_mgr_mutex);
+
/* Call all callbacks of client*/
iter = g_slist_nth(g_config_client_list, 0);
if (NULL != temp_client) {
if (uid == temp_client->uid) {
temp_client->enabled_cb = enabled_cb;
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_NONE;
}
}
iter = g_slist_next(iter);
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_INVALID_PARAMETER;
}
GSList *iter = NULL;
vc_config_client_s* temp_client = NULL;
+ pthread_mutex_lock(&vc_config_mgr_mutex);
+
/* Call all callbacks of client*/
iter = g_slist_nth(g_config_client_list, 0);
if (NULL != temp_client) {
if (uid == temp_client->uid) {
temp_client->enabled_cb = NULL;
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return 0;
}
}
iter = g_slist_next(iter);
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_INVALID_PARAMETER;
}
int vc_config_mgr_get_auto_language(bool* value)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
+
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (NULL == value) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
*value = g_config_info->auto_lang;
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return 0;
}
int vc_config_mgr_set_auto_language(bool value)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
+
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
/* Check language is valid */
if (0 != vc_parser_set_auto_lang(value)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to save engine id");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
+
g_config_info->auto_lang = value;
if (true == g_config_info->auto_lang) {
}
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return 0;
}
int vc_config_mgr_get_engine_list(vc_config_supported_engine_cb callback, void* user_data)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
+
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_INVALID_STATE;
}
if (NULL == callback) {
+ SLOG(LOG_ERROR, vc_config_tag(), " callback is NULL");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_INVALID_PARAMETER;
}
if (0 >= g_slist_length(g_engine_list)) {
SLOG(LOG_WARN, vc_config_tag(), "[ERROR] Engine list is NULL");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
if (NULL == engine_info) {
SLOG(LOG_ERROR, vc_config_tag(), " Engine info is NULL");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_OPERATION_FAILED;
}
iter = g_slist_next(iter);
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_NONE;
}
int vc_config_mgr_get_engine(char** engine)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "Not initialized"); //LCOV_EXCL_LINE
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_INVALID_STATE;
}
if (NULL == engine) {
+ SLOG(LOG_ERROR, vc_config_tag(), "Parameter is NULL");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_INVALID_PARAMETER;
}
*engine = strdup(g_config_info->engine_id);
} else {
SLOG(LOG_ERROR, vc_config_tag(), " Engine id is NULL"); //LCOV_EXCL_LINE
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_NONE;
}
int vc_config_mgr_set_engine(const char* engine)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_INVALID_STATE;
}
if (NULL == g_config_info) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_OPERATION_FAILED;
}
if (NULL == engine || NULL == g_config_info->engine_id) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_INVALID_PARAMETER;
}
/* Check current engine id with new engine id */
if (0 == strncmp(g_config_info->engine_id, engine, strlen(g_config_info->engine_id))) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return 0;
}
int ret = __vc_config_set_buxtonkey(engine);
if (0 != ret) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] set buxtonkey Failed!!!");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return ret;
}
if (0 != vc_parser_set_engine(g_config_info->engine_id)) {
SLOG(LOG_ERROR, vc_config_tag(), " Fail to save config");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_OPERATION_FAILED;
}
} else {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Engine id is not valid");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_INVALID_PARAMETER;
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return VC_CONFIG_ERROR_NONE;
}
int vc_config_mgr_get_language_list(vc_supported_language_cb callback, void* user_data)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (0 >= g_slist_length(g_engine_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] There is no engine");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (NULL == engine_info) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] engine info is NULL");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
break;
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return 0;
}
int vc_config_mgr_get_default_language(char** language)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (NULL == language) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
*language = strdup(g_config_info->language);
} else {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] language is NULL");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return 0;
}
int vc_config_mgr_set_default_language(const char* language)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (NULL == language) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (NULL != g_config_info->language) {
if (0 != vc_parser_set_language(language)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to save engine id");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
free(g_config_info->language);
g_config_info->language = strdup(language);
} else {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] language is NULL");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return 0;
}
int vc_config_mgr_get_enabled(bool* value)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (NULL == value) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
*value = g_config_info->enabled;
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return 0;
}
int vc_config_mgr_set_enabled(bool value)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (0 != vc_parser_set_enabled(value)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to set enabled");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
g_config_info->enabled = value;
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return 0;
}
int vc_config_mgr_get_nonfixed_support(bool* value)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (NULL == value) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Input parameter is NULL");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (0 >= g_slist_length(g_engine_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] There is no engine");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (NULL == engine_info) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] engine info is NULL");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
break;
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return 0;
}
bool vc_config_check_default_engine_is_valid(const char* engine)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (NULL == engine) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return false;
}
- if (0 >= g_slist_length(g_engine_list))
+ if (0 >= g_slist_length(g_engine_list)) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return false;
+ }
GSList *iter = NULL;
vc_engine_info_s *engine_info = NULL;
if (NULL != engine_info) {
if (0 == strcmp(engine, engine_info->uuid)) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return true;
}
}
iter = g_slist_next(iter);
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return false;
}
bool vc_config_check_default_language_is_valid(const char* language)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
if (NULL == language) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return false;
}
if (NULL == g_config_info->engine_id) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Default engine id is NULL");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return false;
}
- if (0 >= g_slist_length(g_engine_list))
+ if (0 >= g_slist_length(g_engine_list)) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return false;
+ }
GSList *iter = NULL;
vc_engine_info_s *engine_info = NULL;
while (NULL != iter_lang) {
lang = iter_lang->data;
- if (0 == strcmp(language, lang))
+ if (0 == strcmp(language, lang)) {
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return true;
+ }
/*Get next item*/
iter_lang = g_slist_next(iter_lang);
break;
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return false;
}
int vc_config_mgr_set_foreground(int pid, bool value)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return vc_parser_set_foreground(pid, value);
}
int vc_config_mgr_get_foreground(int* pid)
{
+ pthread_mutex_lock(&vc_config_mgr_mutex);
if (0 >= g_slist_length(g_config_client_list)) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized");
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return -1;
}
+ pthread_mutex_unlock(&vc_config_mgr_mutex);
return vc_parser_get_foreground(pid);
}