Browse Source

Add Engine::addModule_NoLock() and addCable_NoLock().

tags/v2.5.0
Andrew Belt 1 year ago
parent
commit
d70372535a
2 changed files with 12 additions and 0 deletions
  1. +2
    -0
      include/engine/Engine.hpp
  2. +10
    -0
      src/engine/Engine.cpp

+ 2
- 0
include/engine/Engine.hpp View File

@@ -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.
*/


+ 10
- 0
src/engine/Engine.cpp View File

@@ -710,6 +710,11 @@ std::vector<int64_t> Engine::getModuleIds() {

void Engine::addModule(Module* module) {
std::lock_guard<SharedMutex> 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<int64_t> Engine::getCableIds() {

void Engine::addCable(Cable* cable) {
std::lock_guard<SharedMutex> lock(internal->mutex);
addCable_NoLock(cable);
}


void Engine::addCable_NoLock(Cable* cable) {
assert(cable);
// Check cable properties
assert(cable->inputModule);


Loading…
Cancel
Save