Skip to content
Snippets Groups Projects
Commit 5516cd8d authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

Changed Module::readAll() to read all push-type variables first, to make sure...

Changed Module::readAll() to read all push-type variables first, to make sure that poll-type variables are up-to-date upon return
parent 62b5c33a
No related branches found
No related tags found
No related merge requests found
...@@ -50,8 +50,9 @@ namespace ChimeraTK { ...@@ -50,8 +50,9 @@ namespace ChimeraTK {
* all variables. The returned TransferElement will be the push-type variable which has been updated. */ * all variables. The returned TransferElement will be the push-type variable which has been updated. */
boost::shared_ptr<mtca4u::TransferElement> readAny(); boost::shared_ptr<mtca4u::TransferElement> readAny();
/** Just call read() on all readable variables in the group. If there are push-type variables in the group, this /** Read all readable variables in the group. If there are push-type variables in the group, this call will block
* call will block until all of the variables have received an update. */ * until all of the variables have received an update. All push-type variables are read first, the poll-type
* variables are therefore updated with the latest values upon return. */
void readAll(); void readAll();
/** Just call readNonBlocking() on all readable variables in the group. */ /** Just call readNonBlocking() on all readable variables in the group. */
......
...@@ -79,10 +79,18 @@ namespace ChimeraTK { ...@@ -79,10 +79,18 @@ namespace ChimeraTK {
void Module::readAll() { void Module::readAll() {
auto accessorList = getAccessorListRecursive(); auto accessorList = getAccessorListRecursive();
// first blockingly read all push-type variables
for(auto accessor : accessorList) { for(auto accessor : accessorList) {
if(!accessor.getAppAccessorNoType().isReadable()) continue; if(!accessor.getAppAccessorNoType().isReadable()) continue;
if(accessor.getMode() != UpdateMode::push) continue;
accessor.getAppAccessorNoType().read(); accessor.getAppAccessorNoType().read();
} }
// next non-blockingly read the latest values of all poll-type variables
for(auto accessor : accessorList) {
if(!accessor.getAppAccessorNoType().isReadable()) continue;
if(accessor.getMode() == UpdateMode::push) continue;
accessor.getAppAccessorNoType().readLatest();
}
} }
/*********************************************************************************************************************/ /*********************************************************************************************************************/
......
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