Skip to content
Snippets Groups Projects
Commit 944a1808 authored by Christoph Kampmeyer's avatar Christoph Kampmeyer
Browse files

Merge branch 'wip/ckampm/wip-fix-compatibility-da'

parents 7325d579 2985a403
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,11 @@ namespace ChimeraTK { ...@@ -21,6 +21,11 @@ namespace ChimeraTK {
: ChimeraTK::NDRegisterAccessor<UserType>("UnnamedConstantAccessor", accessModeFlags), _value(length, value) { : ChimeraTK::NDRegisterAccessor<UserType>("UnnamedConstantAccessor", accessModeFlags), _value(length, value) {
ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D.resize(1); ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D.resize(1);
ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D[0] = _value; ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D[0] = _value;
if(TransferElement::_accessModeFlags.has(AccessMode::wait_for_new_data)) {
TransferElement::_readQueue = cppext::future_queue<void>(1);
//TransferElement::_readQueue.push(value);
}
} }
~ConstantAccessor() {} ~ConstantAccessor() {}
......
...@@ -43,7 +43,9 @@ namespace ChimeraTK { ...@@ -43,7 +43,9 @@ namespace ChimeraTK {
void interrupt() override { void interrupt() override {
// call the interrut sequences of the fan out (interrupts for fan input and all outputs), and the ndRegisterAccessor // call the interrut sequences of the fan out (interrupts for fan input and all outputs), and the ndRegisterAccessor
FanOut<UserType>::interrupt(); FanOut<UserType>::interrupt();
ChimeraTK::NDRegisterAccessor<UserType>::interrupt(); if(this->_accessModeFlags.has(AccessMode::wait_for_new_data)) {
ChimeraTK::NDRegisterAccessor<UserType>::interrupt();
}
} }
protected: protected:
......
...@@ -51,10 +51,14 @@ namespace ChimeraTK { ...@@ -51,10 +51,14 @@ namespace ChimeraTK {
// interrupt the input and all slaves // interrupt the input and all slaves
virtual void interrupt() { virtual void interrupt() {
if(impl) { if(impl) {
impl->interrupt(); if(impl->getAccessModeFlags().has(AccessMode::wait_for_new_data)) {
impl->interrupt();
}
} }
for(auto& slave : slaves) { for(auto& slave : slaves) {
slave->interrupt(); if(slave->getAccessModeFlags().has(AccessMode::wait_for_new_data)) {
slave->interrupt();
}
} }
} }
......
...@@ -63,6 +63,8 @@ namespace ChimeraTK { ...@@ -63,6 +63,8 @@ namespace ChimeraTK {
_withReturn(withReturn) { _withReturn(withReturn) {
ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D.resize(1); ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D.resize(1);
ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D[0].resize(numberOfElements); ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D[0].resize(numberOfElements);
TransferElement::_readQueue = cppext::future_queue<void>(1);
} }
/** Add a slave to the FanOut. Only sending end-points of a consuming node may /** Add a slave to the FanOut. Only sending end-points of a consuming node may
...@@ -96,6 +98,8 @@ namespace ChimeraTK { ...@@ -96,6 +98,8 @@ namespace ChimeraTK {
// As this becomes the implemention of the feeding output, the flags are determined by that slave accessor // As this becomes the implemention of the feeding output, the flags are determined by that slave accessor
// In other cases, the information is not relevant because the feeding node is on output which is never read // In other cases, the information is not relevant because the feeding node is on output which is never read
ChimeraTK::NDRegisterAccessor<UserType>::_accessModeFlags = _returnSlave->getAccessModeFlags(); ChimeraTK::NDRegisterAccessor<UserType>::_accessModeFlags = _returnSlave->getAccessModeFlags();
TransferElement::_readQueue = _returnSlave->getReadQueue();
} }
} }
...@@ -222,7 +226,9 @@ namespace ChimeraTK { ...@@ -222,7 +226,9 @@ namespace ChimeraTK {
void interrupt() override { void interrupt() override {
// call the interrut sequences of the fan out (interrupts for fan input and all outputs), and the ndRegisterAccessor // call the interrut sequences of the fan out (interrupts for fan input and all outputs), and the ndRegisterAccessor
FanOut<UserType>::interrupt(); FanOut<UserType>::interrupt();
ChimeraTK::NDRegisterAccessor<UserType>::interrupt(); if(this->_accessModeFlags.has(AccessMode::wait_for_new_data)) {
ChimeraTK::NDRegisterAccessor<UserType>::interrupt();
}
} }
protected: protected:
......
...@@ -114,8 +114,9 @@ namespace ChimeraTK { ...@@ -114,8 +114,9 @@ namespace ChimeraTK {
} }
/** Implement callback called by TransferFuture before it blocks in wait() */ /** Implement callback called by TransferFuture before it blocks in wait() */
// TODO Removed in TE spec. Call preRead isntead, see F.4 // TODO Removed in TE spec. Call preRead isntead, see F.4 Still, has to
//void transferFutureWaitCallback() override { releaseLock(); } // handle multiple calls to preRead in readAny()
void doPreRead(TransferType /*type*/) override { releaseLock(); }
/** Obtain the testableModeLock if not owned yet, and decrement the counter. /** Obtain the testableModeLock if not owned yet, and decrement the counter.
*/ */
......
...@@ -49,7 +49,9 @@ namespace ChimeraTK { ...@@ -49,7 +49,9 @@ namespace ChimeraTK {
void deactivate() override { void deactivate() override {
if(_thread.joinable()) { if(_thread.joinable()) {
_thread.interrupt(); _thread.interrupt();
externalTrigger->interrupt(); if(externalTrigger->getAccessModeFlags().has(AccessMode::wait_for_new_data)) {
externalTrigger->interrupt();
}
_deviceModule.notify(); _deviceModule.notify();
_thread.join(); _thread.join();
} }
......
...@@ -63,7 +63,10 @@ namespace ChimeraTK { ...@@ -63,7 +63,10 @@ namespace ChimeraTK {
while(!moduleThread.try_join_for(boost::chrono::milliseconds(10))) { while(!moduleThread.try_join_for(boost::chrono::milliseconds(10))) {
// if thread is not yet joined, send interrupt() to all variables. // if thread is not yet joined, send interrupt() to all variables.
for(auto& var : getAccessorListRecursive()) { for(auto& var : getAccessorListRecursive()) {
var.getAppAccessorNoType().getHighLevelImplElement()->interrupt(); auto el{var.getAppAccessorNoType().getHighLevelImplElement()};
if(el->getAccessModeFlags().has(AccessMode::wait_for_new_data)) {
el->interrupt();
}
} }
// it may not suffice to send interrupt() once, as the exception might get // it may not suffice to send interrupt() once, as the exception might get
// overwritten in the queue, thus we repeat this until the thread was // overwritten in the queue, thus we repeat this until the thread was
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment