force to release MQ instance
authorYoungjae Shin <yj99.shin@samsung.com>
Tue, 27 Sep 2022 01:55:29 +0000 (10:55 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Wed, 9 Nov 2022 08:14:36 +0000 (17:14 +0900)
src/AITTImpl.cc
src/ModuleManager.cc
src/ModuleManager.h

index 9a77e68..eaecaf4 100644 (file)
@@ -65,6 +65,9 @@ AITT::Impl::~Impl(void)
 
     if (aittThread.joinable())
         aittThread.join();
+
+    discovery.SetMQ(nullptr);
+    mq = nullptr;
 }
 
 void AITT::Impl::ThreadMain(void)
index 960a987..6950c9a 100644 (file)
@@ -78,8 +78,8 @@ std::string ModuleManager::GetTransportFileName(TransportType type)
 
 ModuleManager::ModuleHandle ModuleManager::OpenModule(const char *file)
 {
-    ModuleHandle handle(dlopen(file, RTLD_LAZY | RTLD_LOCAL), [](const void *handle) -> void {
-        if (dlclose(const_cast<void *>(handle)))
+    ModuleHandle handle(dlopen(file, RTLD_LAZY | RTLD_LOCAL), [](void *handle) {
+        if (dlclose(handle))
             ERR("dlclose: %s", dlerror());
     });
     if (handle == nullptr)
index 8754ff5..d71872d 100644 (file)
@@ -35,7 +35,7 @@ class ModuleManager {
     std::unique_ptr<MQ> NewCustomMQ(const std::string &id, const AittOption &option);
 
   private:
-    using ModuleHandle = std::unique_ptr<void, void (*)(const void *)>;
+    using ModuleHandle = std::unique_ptr<void, void (*)(void *)>;
 
     // It should be ("the number of shifts" - 1) of AittProtocol
     enum TransportType {