Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Action::finish() is never used without setState().
[simgrid.git] / src / surf / surf_interface.cpp
index a8a7239..b0007c1 100644 (file)
@@ -634,8 +634,10 @@ Action::~Action() {
   xbt_free(category_);
 }
 
   xbt_free(category_);
 }
 
-void Action::finish() {
+void Action::finish(Action::State state)
+{
   finishTime_ = surf_get_clock();
   finishTime_ = surf_get_clock();
+  setState(state);
 }
 
 Action::State Action::getState()
 }
 
 Action::State Action::getState()
@@ -880,8 +882,7 @@ void Action::updateRemainingLazy(double now)
     //FIXME: duplicated code
     if (((remains_ <= 0) && (lmm_get_variable_weight(getVariable()) > 0)) ||
         ((maxDuration_ > NO_MAX_DURATION) && (maxDuration_ <= 0))) {
     //FIXME: duplicated code
     if (((remains_ <= 0) && (lmm_get_variable_weight(getVariable()) > 0)) ||
         ((maxDuration_ > NO_MAX_DURATION) && (maxDuration_ <= 0))) {
-      finish();
-      setState(Action::State::done);
+      finish(Action::State::done);
       heapRemove(getModel()->getActionHeap());
     }
   }
       heapRemove(getModel()->getActionHeap());
     }
   }