From: Fabien Chaix Date: Fri, 2 Dec 2016 13:30:57 +0000 (-0800) Subject: call updateRemaining when the action is suspended (fix #123) X-Git-Tag: v3_14~127 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e85fd815f2a40f200482bef6f7217e7bc1e45a67 call updateRemaining when the action is suspended (fix #123) if not, the LMM is giving the right results, but surf does not notice. Thus the fix does not touch LMM, only surf_interface.cpp. Note that suspend has the specificity that we cannot estimate when it will end. Thus it does not seem appropriate to use the nextOccuringEventLazy method which is essentially trying to find when will be the next step. Instead I propose to call updateReaminingLazy from the suspend function. --- diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 01bc6f0f6a..3f6b63d7a1 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -744,9 +744,14 @@ void Action::suspend() XBT_IN("(%p)", this); if (suspended_ != 2) { lmm_update_variable_weight(getModel()->getMaxminSystem(), getVariable(), 0.0); - suspended_ = 1; - if (getModel()->getUpdateMechanism() == UM_LAZY) + if (getModel()->getUpdateMechanism() == UM_LAZY){ heapRemove(getModel()->getActionHeap()); + if (getModel()->getUpdateMechanism() == UM_LAZY && stateSet_ == getModel()->getRunningActionSet() && priority_ > 0){ + //If we have a lazy model, we need to update the remaining value accordingly + updateRemainingLazy(surf_get_clock()); + } + } + suspended_ = 1; } XBT_OUT(); }