Save backend dlopen handle (#4784)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Tue, 19 Mar 2019 08:07:32 +0000 (17:07 +0900)
committer이춘석/On-Device Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Tue, 19 Mar 2019 08:07:32 +0000 (17:07 +0900)
Save backend dlopen handle in map member variable
It uses to avoid warning by handle lost without dlclose(), but it will be used to other purpose later

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
runtimes/neurun/core/src/backend/BackendManager.cc
runtimes/neurun/core/src/backend/BackendManager.h

index b263250..4e0c90c 100644 (file)
@@ -73,6 +73,9 @@ void BackendManager::loadBackend(const std::string &backend,
   loadObjectFromPlugin(stage_gen, std::string("allocate_StageGenerator"), handle, operands,
                        tensor_builder);
   _gen_map[config->id()] = {config, stage_gen};
+
+  // Save backend handle (avoid warning by handle lost without dlclose())
+  _handle_map.insert({backend, handle});
 }
 
 BackendManager::BackendManager(const neurun::model::operand::Set &operands)
index 2ef8ed6..8f11e7f 100644 (file)
@@ -37,6 +37,7 @@ public:
 
 private:
   std::map<std::string, Backend> _gen_map;
+  std::map<std::string, void *> _handle_map;
   /**
    * @brief Allocate an object of a class of a plugin by loading a plugin function, that does
    * allocation, and calling it