From: Frederic Suter Date: Sun, 5 Aug 2018 10:24:29 +0000 (+0200) Subject: boot_processes_ vector becomes actors_at_boot_ map X-Git-Tag: v3_21~261^2~1^2~18 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/651f050b85468c6bb07046c9f1932e5cc2ce5ffe boot_processes_ vector becomes actors_at_boot_ map --- diff --git a/src/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index 1084bc0a83..d6235f473b 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -102,6 +102,7 @@ HostImpl::HostImpl(s4u::Host* host) : piface_(host) delete piface_->pimpl_; piface_->pimpl_ = this; } + HostImpl::~HostImpl() { /* All processes should be gone when the host is turned off (by the end of the simulation). */ @@ -116,9 +117,9 @@ HostImpl::~HostImpl() for (auto const& arg : auto_restart_processes_) delete arg; auto_restart_processes_.clear(); - for (auto const& arg : boot_processes_) - delete arg; - boot_processes_.clear(); + for (auto const& arg : actors_at_boot_) + delete arg.second; + actors_at_boot_.clear(); } /** Re-starts all the actors that are marked as restartable. @@ -127,8 +128,9 @@ HostImpl::~HostImpl() */ void HostImpl::turn_on() { - for (auto const& arg : boot_processes_) { - XBT_DEBUG("Booting Process %s(%s) right now", arg->name.c_str(), arg->host->get_cname()); + for (auto const& elm : actors_at_boot_) { + kernel::actor::ProcessArg* arg = elm.second; + XBT_DEBUG("Booting Actor %s(%s) right now", arg->name.c_str(), arg->host->get_cname()); smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host, arg->properties.get(), nullptr); if (arg->kill_time >= 0) @@ -142,9 +144,9 @@ void HostImpl::turn_off() { if (not process_list_.empty()) { for (auto& actor : process_list_) { - SIMIX_process_kill(&actor, SIMIX_process_self()); - XBT_DEBUG("Killing %s@%s on behalf of %s which turned off that host.", actor.get_cname(), + XBT_DEBUG("Killing Actor %s@%s on behalf of %s which turned off that host.", actor.get_cname(), actor.host_->get_cname(), SIMIX_process_self()->get_cname()); + SIMIX_process_kill(&actor, SIMIX_process_self()); } } } diff --git a/src/surf/HostImpl.hpp b/src/surf/HostImpl.hpp index 6672d7afdd..3ed2abb289 100644 --- a/src/surf/HostImpl.hpp +++ b/src/surf/HostImpl.hpp @@ -67,7 +67,7 @@ public: // FIXME: make these private ActorList process_list_; std::vector auto_restart_processes_; - std::vector boot_processes_; + std::map actors_at_boot_; }; } } diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index a3a9c52ac7..55de70536e 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -444,7 +444,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor) simgrid::kernel::actor::ProcessArg* arg = new simgrid::kernel::actor::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart); - host->pimpl_->boot_processes_.push_back(arg); + host->pimpl_->actors_at_boot_.insert({actor_name, arg}); if (start_time > SIMIX_get_clock()) {