pull/1203/head
AlexandreRouma 2023-09-29 14:42:45 +02:00
rodzic a043ab2dd3
commit 55ddd383d2
2 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
#include <utils/flog.h>
bool ModuleComManager::registerInterface(std::string moduleName, std::string name, void (*handler)(int code, void* in, void* out, void* ctx), void* ctx) {
std::lock_guard<std::mutex> lck(mtx);
std::lock_guard<std::recursive_mutex> 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<std::mutex> lck(mtx);
std::lock_guard<std::recursive_mutex> 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<std::mutex> lck(mtx);
std::lock_guard<std::recursive_mutex> lck(mtx);
if (interfaces.find(name) == interfaces.end()) { return false; }
return true;
}
std::string ModuleComManager::getModuleName(std::string name) {
std::lock_guard<std::mutex> lck(mtx);
std::lock_guard<std::recursive_mutex> 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<std::mutex> lck(mtx);
std::lock_guard<std::recursive_mutex> lck(mtx);
if (interfaces.find(name) == interfaces.end()) {
flog::error("Tried to call unknown module interface: {0}", name);
return false;

Wyświetl plik

@ -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<std::string, ModuleComInterface> interfaces;
};