Rename hanel to mBackendModule
authorInki Dae <inki.dae@samsung.com>
Fri, 27 Mar 2020 03:40:26 +0000 (12:40 +0900)
committerInki Dae <inki.dae@samsung.com>
Tue, 14 Apr 2020 00:42:53 +0000 (09:42 +0900)
Just for the cleanup, rename handler to mBackendModule.
The handle points to backend library loaded by dlsym function.

Change-Id: I313d069087389c65296dbda368666b6d5079c50c
Signed-off-by: Inki Dae <inki.dae@samsung.com>
include/inference_engine_common_impl.h
src/inference_engine_common_impl.cpp

index 31742f992e20e0480006bc9f881733fa2a2504ea..7bb6445ad351f7ec6630b25d91355212047194e8 100755 (executable)
@@ -218,7 +218,7 @@ private:
     std::string mBackendLibName;
     inference_backend_type_e mSelectedBackendEngine;
 protected:
-    void *handle;
+    void *mBackendModule;
     IInferenceEngineCommon *engine;
 
 };
index b64a11ed4f7f7a3eb414466dc95d4c154753a733..7d0f51355d39f9fb296c6301e5a3709cfd9fcbce 100755 (executable)
@@ -40,7 +40,7 @@ namespace InferenceEngineInterface {
 namespace Common {
 InferenceEngineCommon::InferenceEngineCommon() :
     mSelectedBackendEngine(INFERENCE_BACKEND_NONE),
-    handle(nullptr),
+    mBackendModule(nullptr),
     engine(nullptr)
 {
     LOGE("ENTER");
@@ -54,7 +54,7 @@ InferenceEngineCommon::InferenceEngineCommon() :
 
 InferenceEngineCommon::InferenceEngineCommon(std::string backend) :
     mSelectedBackendEngine(INFERENCE_BACKEND_NONE),
-    handle(nullptr),
+    mBackendModule(nullptr),
     engine(nullptr)
 {
     LOGE("ENTER");
@@ -64,7 +64,7 @@ InferenceEngineCommon::InferenceEngineCommon(std::string backend) :
 
 InferenceEngineCommon::InferenceEngineCommon(inference_backend_type_e backend) :
     mSelectedBackendEngine(INFERENCE_BACKEND_NONE),
-    handle(nullptr),
+    mBackendModule(nullptr),
     engine(nullptr)
 {
     LOGE("ENTER");
@@ -76,7 +76,7 @@ InferenceEngineCommon::InferenceEngineCommon(inference_backend_type_e backend) :
 
 InferenceEngineCommon::InferenceEngineCommon(inference_engine_config *config) :
     mSelectedBackendEngine(INFERENCE_BACKEND_NONE),
-    handle(nullptr),
+    mBackendModule(nullptr),
     engine(nullptr)
 {
     LOGI("ENTER");
@@ -100,26 +100,28 @@ int InferenceEngineCommon::BindBackend(inference_engine_config *config)
 
     char *error = NULL;
     LOGI("lib: %s", mBackendLibName.c_str());
-    handle = dlopen(mBackendLibName.c_str(), RTLD_NOW);
-    LOGI("HANDLE : [%p]", handle);
+    mBackendModule = dlopen(mBackendLibName.c_str(), RTLD_NOW);
+    LOGI("HANDLE : [%p]", mBackendModule);
 
-    if (!handle) {
+    if (!mBackendModule) {
         LOGE("Fail to dlopen %s", mBackendLibName.c_str());
         LOGE("Error: %s\n", dlerror());
         return  INFERENCE_ENGINE_ERROR_NOT_SUPPORTED;
     }
 
-    init_t* EngineInit = (init_t *)dlsym(handle, "EngineCommonInit");
+    init_t* EngineInit = (init_t *)dlsym(mBackendModule, "EngineCommonInit");
     if ((error = dlerror()) != NULL) {
         LOGE("Error: %s\n", error);
-        dlclose(handle);
+        dlclose(mBackendModule);
+               mBackendModule = nullptr;
         return INFERENCE_ENGINE_ERROR_INTERNAL;
     }
 
     engine = EngineInit();
     if (engine == NULL) {
         LOGE("Fail to EngineInit");
-        dlclose(handle);
+        dlclose(mBackendModule);
+               mBackendModule = nullptr;
         return INFERENCE_ENGINE_ERROR_INTERNAL;
     }
 
@@ -132,12 +134,12 @@ void InferenceEngineCommon::UnbindBackend(void)
 {
     LOGW("ENTER");
 
-    if (handle) {
-        destroy_t *engineDestroy = (destroy_t*)dlsym(handle, "EngineCommonDestroy");
+    if (mBackendModule) {
+        destroy_t *engineDestroy = (destroy_t*)dlsym(mBackendModule, "EngineCommonDestroy");
         engineDestroy(engine);
-        dlclose(handle);
+        dlclose(mBackendModule);
         engine = nullptr;
-        handle = nullptr;
+        mBackendModule = nullptr;
     }
 
     LOGW("LEAVE");