From: Maxwell Pirtle Date: Thu, 11 May 2023 13:36:28 +0000 (+0200) Subject: Add boolean check for wakeup tree initialization X-Git-Tag: v3.34~68^2~34 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/87dd4584804ecf97b8bd32cec01e31a9cdc0e541 Add boolean check for wakeup tree initialization While not great, one way to prevent the wakeup tree from continuing to add elements after it has already done so when empty is to add a boolean flag that's checked to prevent the addition. For now, we'll live with it --- diff --git a/src/mc/api/State.cpp b/src/mc/api/State.cpp index fb2a806d41..3a1a0ac47d 100644 --- a/src/mc/api/State.cpp +++ b/src/mc/api/State.cpp @@ -190,6 +190,10 @@ std::unordered_set State::get_backtrack_set() const void State::seed_wakeup_tree_if_needed(const odpor::Execution& prior) { + // TODO: It would be better not to have such a flag. + if (has_initialized_wakeup_tree) { + return; + } // TODO: Note that the next action taken by the actor may be updated // after it executes. But we will have already inserted it into the // tree and decided upon "happens-before" at that point for different @@ -199,6 +203,7 @@ void State::seed_wakeup_tree_if_needed(const odpor::Execution& prior) wakeup_tree_.insert(prior, odpor::PartialExecution{strategy_->actors_to_run_.at(next).get_transition()}); } } + has_initialized_wakeup_tree = true; } void State::sprout_tree_from_parent_state() diff --git a/src/mc/api/State.hpp b/src/mc/api/State.hpp index c1aace8d0b..fb1429a434 100644 --- a/src/mc/api/State.hpp +++ b/src/mc/api/State.hpp @@ -52,6 +52,7 @@ class XBT_PRIVATE State : public xbt::Extendable { * and with respect to this state's sleep set */ odpor::WakeupTree wakeup_tree_; + bool has_initialized_wakeup_tree = false; public: explicit State(RemoteApp& remote_app);