From: Inki Dae Date: Fri, 27 Mar 2020 03:40:26 +0000 (+0900) Subject: Rename hanel to mBackendModule X-Git-Tag: submit/tizen/20200423.063253~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9dd10c4c8b49fdcb3b978e121197ef3ef7a91acd;p=platform%2Fcore%2Fmultimedia%2Finference-engine-interface.git Rename hanel to mBackendModule 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 --- diff --git a/include/inference_engine_common_impl.h b/include/inference_engine_common_impl.h index 31742f9..7bb6445 100755 --- a/include/inference_engine_common_impl.h +++ b/include/inference_engine_common_impl.h @@ -218,7 +218,7 @@ private: std::string mBackendLibName; inference_backend_type_e mSelectedBackendEngine; protected: - void *handle; + void *mBackendModule; IInferenceEngineCommon *engine; }; diff --git a/src/inference_engine_common_impl.cpp b/src/inference_engine_common_impl.cpp index b64a11e..7d0f513 100755 --- a/src/inference_engine_common_impl.cpp +++ b/src/inference_engine_common_impl.cpp @@ -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");