Skip to content

Commit 55ddd38

Browse files
1 parent a043ab2 commit 55ddd38

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

core/src/module_com.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <utils/flog.h>
33

44
bool 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

1818
bool 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

2828
bool 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

3434
std::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

4343
bool 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;

core/src/module_com.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ class ModuleComManager {
1818
bool callInterface(std::string name, int code, void* in, void* out);
1919

2020
private:
21-
std::mutex mtx;
21+
std::recursive_mutex mtx;
2222
std::map<std::string, ModuleComInterface> interfaces;
2323
};

0 commit comments

Comments
 (0)