void (*set_value) (int, const char *, gpointer);
int (*get_value) (int, const char *, gpointer *);
void (*free) (void);
+ GMutex module_lock[MUSE_MODULE_MAX];
gboolean module_loaded[MUSE_MODULE_MAX];
GModule *module[MUSE_MODULE_MAX];
GHashTable *table[MUSE_MODULE_MAX];
module->ch[MUSE_CHANNEL_MSG].tbm_fd = tbm_fd;
if (module->is_create_api_called == false) {
+
+ pthread_mutex_lock(&muse_core_workqueue_get_instance()->jobs_mutex);
+
if (muse_core_msg_json_deserialize(MUSE_MODULE, module->recvMsg + module->msg_offset, &parse_len, &api_module, &err, MUSE_TYPE_INT)) {
module->api_module = api_module;
module->ch[MUSE_CHANNEL_DATA].queue = g_queue_new();
muse_core_module_get_instance()->close(module);
}
+ pthread_mutex_unlock(&muse_core_workqueue_get_instance()->jobs_mutex);
+
_muse_core_ipc_client_cleanup(module);
}
break;
g_return_if_fail(keyname != NULL);
gpointer orig_key;
+
+ g_mutex_lock(&g_muse_core_module->module_lock[api_module]);
+
/* Try looking up this key. */
if (g_hash_table_lookup_extended(g_muse_core_module->table[api_module], keyname, &orig_key, NULL)) {
g_hash_table_remove(g_muse_core_module->table[api_module], keyname);
/* Insert into our hash table it is not a duplicate. */
g_hash_table_insert(g_muse_core_module->table[api_module], g_strdup(keyname), value);
}
+
+ g_mutex_unlock(&g_muse_core_module->module_lock[api_module]);
}
static int _muse_core_module_get_dllsymbol_value(int api_module, const char *keyname, gpointer *value)
g_return_if_fail(g_muse_core_module != NULL);
for (idx = 0; idx < MUSE_MODULE_MAX; idx++) {
+ g_mutex_clear(&g_muse_core_module->module_lock[idx]);
g_module_close(g_muse_core_module->module[idx]);
g_hash_table_foreach_remove(g_muse_core_module->table[idx], _muse_core_module_free_key, NULL);
g_hash_table_destroy(g_muse_core_module->table[idx]);
g_muse_core_module->get_value = get_value;
for (idx = 0; idx < MUSE_MODULE_MAX; idx++) {
+ g_mutex_init(&g_muse_core_module->module_lock[idx]);
g_muse_core_module->module_loaded[idx] = false;
g_muse_core_module->table[idx] = g_hash_table_new(g_str_hash, g_str_equal);
g_return_if_fail(g_muse_core_module->table[idx] != NULL);