From e180d501b28577208fcd843c54afbe665b4c4fab Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 25 Mar 2025 18:12:02 -0400 Subject: [PATCH] cwFlowTypes.h/cpp,cwFlowNet.cpp : added modVarRecurseFl. --- cwFlowNet.cpp | 8 +++++++- cwFlowTypes.cpp | 5 ++--- cwFlowTypes.h | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cwFlowNet.cpp b/cwFlowNet.cpp index ba46e4f..2bf369b 100644 --- a/cwFlowNet.cpp +++ b/cwFlowNet.cpp @@ -3649,6 +3649,9 @@ cw::rc_t cw::flow::exec_cycle( network_t& net ) for(unsigned i=0; imodVarRecurseFl = true; + // Call notify() on all variables marked for notification that have changed since the last exec_cycle() proc_notify(net.procA[i], kCallbackPnFl | kQuietPnFl); @@ -3662,7 +3665,10 @@ cw::rc_t cw::flow::exec_cycle( network_t& net ) rc = cwLogError(rc,"Execution failed on the proc:%s:%i.",cwStringNullGuard(net.procA[i]->label),net.procA[i]->label_sfx_id); break; } - } + } + + net.procA[i]->modVarRecurseFl = false; + } return halt_fl ? ((unsigned)kEofRC) : rc; diff --git a/cwFlowTypes.cpp b/cwFlowTypes.cpp index f0267b7..98a8ac9 100644 --- a/cwFlowTypes.cpp +++ b/cwFlowTypes.cpp @@ -164,7 +164,7 @@ namespace cw rc_t _mod_var_map_update( variable_t* var ) { rc_t rc = kOkRC; - if( cwIsFlag(var->varDesc->flags,kNotifyVarDescFl ) ) + if( cwIsFlag(var->varDesc->flags,kNotifyVarDescFl ) && var->proc->modVarRecurseFl==false ) { // if the var is already modVarMapA[] then there is nothing to do // (use acquire to prevent rd/wr from moving before this op) @@ -794,8 +794,7 @@ errLabel: cw::rc_t cw::flow::class_preset_has_var( const class_preset_t* class_preset, const char* var_label, bool& fl_ref ) { rc_t rc = kOkRC; - const object_t* var_cfg; - + fl_ref = false; if( class_preset->cfg == nullptr ) diff --git a/cwFlowTypes.h b/cwFlowTypes.h index c659c05..105d26d 100644 --- a/cwFlowTypes.h +++ b/cwFlowTypes.h @@ -151,6 +151,7 @@ namespace cw unsigned varMapN; // varMapN = varMapIdN * varMapChN variable_t** varMapA; // varMapA[ varMapN ] = allows fast lookup from ('vid','chIdx) to variable + bool modVarRecurseFl; // flag used to prevent call to set_var() from inside _notify() from calling var_schedule_notification() variable_t** modVarMapA; // modVarMapA[ modVarMapN ] unsigned modVarMapN; // modVarMapN == varMapN unsigned modVarMapTailIdx; // index of next full slot in varMapA[]