diff --git a/include/DeviceModule.h b/include/DeviceModule.h index e53ecf75d4ca96642e26822822a8273d353e6c0b..44717ff21c98fea7d38e0e69953667ed7400d94a 100644 --- a/include/DeviceModule.h +++ b/include/DeviceModule.h @@ -257,10 +257,6 @@ namespace ChimeraTK { * The function is running an endless loop inside its own thread (moduleThread). */ void handleException(); - /** List of TransferElements to be written after the device has been opened. This is used to write constant feeders - * to the device. */ - std::list<boost::shared_ptr<TransferElement>> writeAfterOpen; - /** List of TransferElements to be written after the device has been recovered. * See function addRecoveryAccessor() for details.*/ std::list<boost::shared_ptr<TransferElement>> writeRecoveryOpen; diff --git a/src/Application.cc b/src/Application.cc index f44320224cb22bf75fa4f46e4f1fc6209299fc77..9ed358a025c5cb4b6d20ed67fde747b6e957c158 100644 --- a/src/Application.cc +++ b/src/Application.cc @@ -1019,7 +1019,7 @@ void Application::typedMakeConnection(VariableNetwork& network) { } assert(devmod != nullptr); // register feeder to be written after the device has been opened - devmod->writeAfterOpen.push_back(impl); + devmod->writeRecoveryOpen.push_back(impl); } else if(consumer.getType() == NodeType::TriggerReceiver) { throw ChimeraTK::logic_error("Using constants as triggers is not supported!"); diff --git a/src/DeviceModule.cc b/src/DeviceModule.cc index ae76d4cdc29504e1f86938c3a9253e477d7e6731..64029da705bd8b29c8c7cd354ed4d4e4dcd05194 100644 --- a/src/DeviceModule.cc +++ b/src/DeviceModule.cc @@ -294,13 +294,16 @@ namespace ChimeraTK { } } } + // The device was successfully opened, try to initialise it try { for(auto& initHandler : initialisationHandlers) { initHandler(this); } - for(auto& te : writeAfterOpen) { - te->write(); + for(auto& te : writeRecoveryOpen) { + if(te->getVersionNumber() != VersionNumber{nullptr}) { + te->write(); + } } } catch(ChimeraTK::runtime_error& e) { diff --git a/src/ExceptionHandlingDecorator.cc b/src/ExceptionHandlingDecorator.cc index 2eae375e7a76df2880af32804b01ab4fb932eb5a..caa98bfae82bbb69c8530c5f6b45101d5ab8410c 100644 --- a/src/ExceptionHandlingDecorator.cc +++ b/src/ExceptionHandlingDecorator.cc @@ -52,9 +52,6 @@ namespace ChimeraTK { // If the application has not yet fully started, we cannot wait for the device to open. Instead register // the variable in the DeviceMoule, so the transfer will be performed after the device is opened. assert(_recoveryAccessor != nullptr); // should always be true for writeable registers with this decorator - // Note: it's ok to use the recoveryAccessor here as well, since device opening and recovery happens in the - // same thread in the DeviceModule. - deviceModule.writeAfterOpen.push_back(this->_recoveryAccessor); return false; } // We artificially increase the testabel mode counter so the test does not slip out of testable mode here in case