Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add boolean check for wakeup tree initialization
authorMaxwell Pirtle <maxwellpirtle@gmail.com>
Thu, 11 May 2023 13:36:28 +0000 (15:36 +0200)
committerMaxwell Pirtle <maxwellpirtle@gmail.com>
Tue, 16 May 2023 07:50:34 +0000 (09:50 +0200)
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

src/mc/api/State.cpp
src/mc/api/State.hpp

index fb2a806..3a1a0ac 100644 (file)
@@ -190,6 +190,10 @@ std::unordered_set<aid_t> 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()
index c1aace8..fb1429a 100644 (file)
@@ -52,6 +52,7 @@ class XBT_PRIVATE State : public xbt::Extendable<State> {
    * 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);