From d70372535a2369b5972e6eeff7e4918f5ea8c827 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Fri, 8 Sep 2023 04:48:12 -0400 Subject: [PATCH] Add Engine::addModule_NoLock() and addCable_NoLock(). --- include/engine/Engine.hpp | 2 ++ src/engine/Engine.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/engine/Engine.hpp b/include/engine/Engine.hpp index 88ecd417..ce1c5c79 100644 --- a/include/engine/Engine.hpp +++ b/include/engine/Engine.hpp @@ -106,6 +106,7 @@ struct Engine { Exclusively locks. */ void addModule(Module* module); + PRIVATE void addModule_NoLock(Module* module); /** Removes a Module from the rack. Exclusively locks. */ @@ -168,6 +169,7 @@ struct Engine { Exclusively locks. */ void addCable(Cable* cable); + PRIVATE void addCable_NoLock(Cable* cable); /** Removes a Cable from the rack. Exclusively locks. */ diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index fd2a48c5..5bb43b78 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -710,6 +710,11 @@ std::vector Engine::getModuleIds() { void Engine::addModule(Module* module) { std::lock_guard lock(internal->mutex); + addModule_NoLock(module); +} + + +void Engine::addModule_NoLock(Module* module) { assert(module); // Check that the module is not already added auto it = std::find(internal->modules.begin(), internal->modules.end(), module); @@ -918,6 +923,11 @@ std::vector Engine::getCableIds() { void Engine::addCable(Cable* cable) { std::lock_guard lock(internal->mutex); + addCable_NoLock(cable); +} + + +void Engine::addCable_NoLock(Cable* cable) { assert(cable); // Check cable properties assert(cable->inputModule);