From 6bf6b49a12572dfc37683568f73ae0eef4cfcfb9 Mon Sep 17 00:00:00 2001 From: Martin Hierholzer <martin.hierholzer@desy.de> Date: Tue, 21 Apr 2020 18:11:17 +0200 Subject: [PATCH] fix not obeying hasNewData flag in two places --- include/FeedingFanOut.h | 1 + include/TestableModeAccessorDecorator.h | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/FeedingFanOut.h b/include/FeedingFanOut.h index 6e7c50b0..6c6931f6 100644 --- a/include/FeedingFanOut.h +++ b/include/FeedingFanOut.h @@ -128,6 +128,7 @@ namespace ChimeraTK { assert(_hasReturnSlave); auto _ = cppext::finally([&] { + if(!hasNewData) return; _returnSlave->accessChannel(0).swap(ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D[0]); // distribute return-channel update to the other slaves for(auto& slave : FanOut<UserType>::slaves) { // send out copies to slaves diff --git a/include/TestableModeAccessorDecorator.h b/include/TestableModeAccessorDecorator.h index a83bdd93..b608e4ee 100644 --- a/include/TestableModeAccessorDecorator.h +++ b/include/TestableModeAccessorDecorator.h @@ -118,8 +118,9 @@ namespace ChimeraTK { /** Obtain the testableModeLock if not owned yet, and decrement the counter. */ - void obtainLockAndDecrementCounter() { + void obtainLockAndDecrementCounter(bool hasNewData) { if(!Application::testableModeTestLock()) Application::testableModeLock("doReadTransfer " + this->getName()); + if(!hasNewData) return; if(Application::getInstance().testableMode_perVarCounter[_variableIdRead] > 0) { assert(Application::getInstance().testableMode_counter > 0); --Application::getInstance().testableMode_counter; @@ -147,7 +148,7 @@ namespace ChimeraTK { /** Obtain the testableModeLock if not owned yet, decrement the counter, and * release the lock again. */ void decrementCounter() { - obtainLockAndDecrementCounter(); + obtainLockAndDecrementCounter(true); releaseLock(); } @@ -176,7 +177,7 @@ namespace ChimeraTK { } void doPostRead(TransferType type, bool hasNewData) override { - if(_handleRead) obtainLockAndDecrementCounter(); + if(_handleRead) obtainLockAndDecrementCounter(hasNewData); ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPostRead(type, hasNewData); } -- GitLab