X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f0534a5e2af72c36c12d55f7ea323040e6e9bf36..HEAD:/src/kernel/resource/Resource.hpp?ds=sidebyside diff --git a/src/kernel/resource/Resource.hpp b/src/kernel/resource/Resource.hpp index 9e2f2842fc..1ed1e3541c 100644 --- a/src/kernel/resource/Resource.hpp +++ b/src/kernel/resource/Resource.hpp @@ -7,6 +7,7 @@ #define SIMGRID_KERNEL_RESOURCE_RESOURCE_HPP #include "simgrid/forward.h" +#include "src/kernel/EngineImpl.hpp" #include "src/kernel/actor/Simcall.hpp" #include "src/kernel/lmm/maxmin.hpp" // Constraint #include "src/kernel/resource/profile/Event.hpp" @@ -72,6 +73,21 @@ template class Resource_T : public Resource { Model* model_ = nullptr; lmm::Constraint* constraint_ = nullptr; +protected: + void cancel_actions() + { + const kernel::lmm::Element* elem = nullptr; + double now = EngineImpl::get_clock(); + while (const auto* var = get_constraint()->get_variable(&elem)) { + Action* action = var->get_id(); + if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED || + action->get_state() == Action::State::IGNORED) { + action->set_finish_time(now); + action->set_state(Action::State::FAILED); + } + } + } + public: using Resource::Resource; /** @brief setup the profile file with states events (ON or OFF). The profile must contain boolean values. */