22#include < utils/flog.h>
33
44bool ModuleComManager::registerInterface (std::string moduleName, std::string name, void (*handler)(int code, void * in, void * out, void * ctx), void* ctx) {
5- std::lock_guard<std::mutex > lck (mtx);
5+ std::lock_guard<std::recursive_mutex > lck (mtx);
66 if (interfaces.find (name) != interfaces.end ()) {
77 flog::error (" Tried creating module interface with an existing name: {0}" , name);
88 return false ;
@@ -16,7 +16,7 @@ bool ModuleComManager::registerInterface(std::string moduleName, std::string nam
1616}
1717
1818bool ModuleComManager::unregisterInterface (std::string name) {
19- std::lock_guard<std::mutex > lck (mtx);
19+ std::lock_guard<std::recursive_mutex > lck (mtx);
2020 if (interfaces.find (name) == interfaces.end ()) {
2121 flog::error (" Tried to erase module interface with unknown name: {0}" , name);
2222 return false ;
@@ -26,13 +26,13 @@ bool ModuleComManager::unregisterInterface(std::string name) {
2626}
2727
2828bool ModuleComManager::interfaceExists (std::string name) {
29- std::lock_guard<std::mutex > lck (mtx);
29+ std::lock_guard<std::recursive_mutex > lck (mtx);
3030 if (interfaces.find (name) == interfaces.end ()) { return false ; }
3131 return true ;
3232}
3333
3434std::string ModuleComManager::getModuleName (std::string name) {
35- std::lock_guard<std::mutex > lck (mtx);
35+ std::lock_guard<std::recursive_mutex > lck (mtx);
3636 if (interfaces.find (name) == interfaces.end ()) {
3737 flog::error (" Tried to call unknown module interface: {0}" , name);
3838 return " " ;
@@ -41,7 +41,7 @@ std::string ModuleComManager::getModuleName(std::string name) {
4141}
4242
4343bool ModuleComManager::callInterface (std::string name, int code, void * in, void * out) {
44- std::lock_guard<std::mutex > lck (mtx);
44+ std::lock_guard<std::recursive_mutex > lck (mtx);
4545 if (interfaces.find (name) == interfaces.end ()) {
4646 flog::error (" Tried to call unknown module interface: {0}" , name);
4747 return false ;
0 commit comments