X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5dfff0d610d01d61458294991d8793dc3bdbf1a7..3cb644bc04ff9dd4da159790850b6bcfda970cf9:/src/kernel/actor/ActorImpl.cpp diff --git a/src/kernel/actor/ActorImpl.cpp b/src/kernel/actor/ActorImpl.cpp index 8b0ccf736b..013ad5b217 100644 --- a/src/kernel/actor/ActorImpl.cpp +++ b/src/kernel/actor/ActorImpl.cpp @@ -8,6 +8,7 @@ #include #include +#include "src/internal_config.h" #include "src/kernel/EngineImpl.hpp" #if HAVE_SMPI #include "src/smpi/include/private.hpp" @@ -43,8 +44,10 @@ ActorImpl::ActorImpl(const std::string& name, s4u::Host* host, aid_t ppid) ActorImpl::~ActorImpl() { - if (EngineImpl::has_instance() && not EngineImpl::get_instance()->is_maestro(this)) + if (EngineImpl::has_instance() && not EngineImpl::get_instance()->is_maestro(this)) { s4u::Actor::on_destruction(*get_ciface()); + get_ciface()->on_this_destruction(*get_ciface()); + } } /* Become an actor in the simulation @@ -126,14 +129,9 @@ void ActorImpl::cleanup_from_kernel() if (not kernel_destroy_list_hook.is_linked()) engine->add_actor_to_destroy_list(*this); - if (has_to_auto_restart() && not get_host()->is_on()) { - XBT_DEBUG("Insert host %s to watched_hosts because it's off and %s needs to restart", get_host()->get_cname(), - get_cname()); - watched_hosts().insert(get_host()->get_name()); - } - undaemonize(); s4u::Actor::on_termination(*get_ciface()); + get_ciface()->on_this_termination(*get_ciface()); while (not mailboxes_.empty()) mailboxes_.back()->set_receiver(nullptr); @@ -188,7 +186,7 @@ void ActorImpl::exit() activity::ActivityImplPtr activity = waiting_synchro_; activity->cancel(); activity->set_state(activity::State::FAILED); - activity->post(); + activity->finish(); activities_.erase(waiting_synchro_); waiting_synchro_ = nullptr; @@ -357,12 +355,12 @@ activity::ActivityImplPtr ActorImpl::join(const ActorImpl* actor, double timeout { activity::ActivityImplPtr sleep_activity = this->sleep(timeout); if (actor->wannadie() || actor->to_be_freed()) { - if (sleep_activity->surf_action_) - sleep_activity->surf_action_->finish(resource::Action::State::FINISHED); + if (sleep_activity->model_action_) + sleep_activity->model_action_->finish(resource::Action::State::FINISHED); } else { actor->on_exit->emplace_back([sleep_activity](bool) { - if (sleep_activity->surf_action_) - sleep_activity->surf_action_->finish(resource::Action::State::FINISHED); + if (sleep_activity->model_action_) + sleep_activity->model_action_->finish(resource::Action::State::FINISHED); }); } return sleep_activity; @@ -374,7 +372,7 @@ activity::ActivityImplPtr ActorImpl::sleep(double duration) throw_exception(std::make_exception_ptr( HostFailureException(XBT_THROW_POINT, "Host " + host_->get_name() + " failed, you cannot sleep there."))); - auto sleep_activity = new activity::SleepImpl(); + auto* sleep_activity = new activity::SleepImpl(); sleep_activity->set_name("sleep").set_host(host_).set_duration(duration).start(); return activity::SleepImplPtr(sleep_activity); }