#include "simgrid/exec.h"
#include "simgrid/s4u/Actor.hpp"
#include "simgrid/s4u/Exec.hpp"
+#include "simgrid/s4u/Host.hpp"
#include "src/kernel/activity/ExecImpl.hpp"
#include "src/kernel/actor/ActorImpl.hpp"
#include "src/kernel/actor/SimcallObserver.hpp"
ExecPtr Exec::init()
{
auto pimpl = kernel::activity::ExecImplPtr(new kernel::activity::ExecImpl());
+ Host::on_state_change.connect([pimpl](s4u::Host const& h) {
+ if (not h.is_on() && pimpl->state_ == kernel::activity::State::RUNNING &&
+ std::find(pimpl->get_hosts().begin(), pimpl->get_hosts().end(), &h) != pimpl->get_hosts().end()) {
+ pimpl->state_ = kernel::activity::State::FAILED;
+ pimpl->post();
+ }
+ });
return ExecPtr(pimpl->get_iface());
}
return this;
}
-ExecPtr Exec::set_timeout(double timeout) // XBT_ATTRIB_DEPRECATED_v329
-{
- xbt_assert(state_ == State::INITED || state_ == State::STARTING,
- "Cannot change the bound of an exec after its start");
- kernel::actor::simcall(
- [this, timeout] { boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_)->set_timeout(timeout); });
- return this;
-}
-
ExecPtr Exec::set_flops_amount(double flops_amount)
{
xbt_assert(state_ == State::INITED || state_ == State::STARTING,