module->api_module = api_module;
module->ch[MUSE_CHANNEL_DATA].queue = g_queue_new();
g_mutex_init(&module->ch[MUSE_CHANNEL_DATA].mutex);
+
+ value = muse_core_module_get_instance()->get_dllsymbol_loaded_value(api_module);
+
module->ch[MUSE_CHANNEL_MSG].dll_handle = muse_core_module_get_instance()->load(api_module);
}
}
if (module->is_create_api_called == false) {
LOGE("<<< ### _muse_core_ipc_client_cleanup [module %p] [get_dllsymbol_loaded_value %d]", module, value);
+
+ if (!value) {
+ LOGW("release module dll handle");
+ muse_core_module_get_instance()->close(module);
+ }
+
_muse_core_ipc_client_cleanup(module);
}
break;
{
g_return_val_if_fail(module != NULL, FALSE);
- _muse_core_module_set_dllsymbol_loaded_value(module->api_module, module->ch[MUSE_CHANNEL_MSG].dll_handle, false);
-
LOGD("Closing module %s", g_module_name(module->ch[MUSE_CHANNEL_MSG].dll_handle));
if (!g_module_close(module->ch[MUSE_CHANNEL_MSG].dll_handle)) {
LOGE("Couldn't close dll_handle %s: %s", g_module_name(module->ch[MUSE_CHANNEL_MSG].dll_handle), g_module_error());
return FALSE;
}
+ _muse_core_module_set_dllsymbol_loaded_value(module->api_module, NULL, false);
+
return TRUE;
}
static GModule *_muse_core_module_get_dllsymbol(int api_module)
static void _muse_core_module_set_dllsymbol_loaded_value(int api_module, GModule *module, gboolean value)
{
g_return_if_fail(g_muse_core_module!= NULL);
- g_return_if_fail(module != NULL);
g_muse_core_module->module_loaded[api_module] = value;
g_muse_core_module->module[api_module] = module;
LOGD("dll_handle: %p", g_muse_core_module->module[api_module]);
}
+
static gboolean _muse_core_module_get_dllsymbol_loaded_value(int api_module)
{
g_return_val_if_fail(g_muse_core_module != NULL, false);