diff --git a/core/src/module_com.cpp b/core/src/module_com.cpp index 7c721753..ae3a9ae7 100644 --- a/core/src/module_com.cpp +++ b/core/src/module_com.cpp @@ -2,7 +2,7 @@ #include bool ModuleComManager::registerInterface(std::string moduleName, std::string name, void (*handler)(int code, void* in, void* out, void* ctx), void* ctx) { - std::lock_guard lck(mtx); + std::lock_guard lck(mtx); if (interfaces.find(name) != interfaces.end()) { flog::error("Tried creating module interface with an existing name: {0}", name); return false; @@ -16,7 +16,7 @@ bool ModuleComManager::registerInterface(std::string moduleName, std::string nam } bool ModuleComManager::unregisterInterface(std::string name) { - std::lock_guard lck(mtx); + std::lock_guard lck(mtx); if (interfaces.find(name) == interfaces.end()) { flog::error("Tried to erase module interface with unknown name: {0}", name); return false; @@ -26,13 +26,13 @@ bool ModuleComManager::unregisterInterface(std::string name) { } bool ModuleComManager::interfaceExists(std::string name) { - std::lock_guard lck(mtx); + std::lock_guard lck(mtx); if (interfaces.find(name) == interfaces.end()) { return false; } return true; } std::string ModuleComManager::getModuleName(std::string name) { - std::lock_guard lck(mtx); + std::lock_guard lck(mtx); if (interfaces.find(name) == interfaces.end()) { flog::error("Tried to call unknown module interface: {0}", name); return ""; @@ -41,7 +41,7 @@ std::string ModuleComManager::getModuleName(std::string name) { } bool ModuleComManager::callInterface(std::string name, int code, void* in, void* out) { - std::lock_guard lck(mtx); + std::lock_guard lck(mtx); if (interfaces.find(name) == interfaces.end()) { flog::error("Tried to call unknown module interface: {0}", name); return false; diff --git a/core/src/module_com.h b/core/src/module_com.h index 7d6dd5bd..b3b6d16c 100644 --- a/core/src/module_com.h +++ b/core/src/module_com.h @@ -18,6 +18,6 @@ public: bool callInterface(std::string name, int code, void* in, void* out); private: - std::mutex mtx; + std::recursive_mutex mtx; std::map interfaces; }; \ No newline at end of file