Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
HostImpl::turn_off(): SIMIX_process_self is maestro there, save real process before...
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 31 Oct 2019 21:25:44 +0000 (22:25 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 31 Oct 2019 22:04:43 +0000 (23:04 +0100)
src/s4u/s4u_Host.cpp
src/surf/HostImpl.cpp
src/surf/HostImpl.hpp

index 2a78d57..305a573 100644 (file)
@@ -97,14 +97,15 @@ void Host::turn_on()
 void Host::turn_off()
 {
   if (is_on()) {
 void Host::turn_off()
 {
   if (is_on()) {
-    kernel::actor::simcall([this] {
+    kernel::actor::ActorImpl* self = SIMIX_process_self();
+    kernel::actor::simcall([this, self] {
       for (VirtualMachine* const& vm : vm::VirtualMachineImpl::allVms_)
         if (vm->get_pm() == this) {
           vm->shutdown();
           vm->turn_off();
         }
       this->pimpl_cpu->turn_off();
       for (VirtualMachine* const& vm : vm::VirtualMachineImpl::allVms_)
         if (vm->get_pm() == this) {
           vm->shutdown();
           vm->turn_off();
         }
       this->pimpl_cpu->turn_off();
-      this->pimpl_->turn_off();
+      this->pimpl_->turn_off(self);
 
       on_state_change(*this);
     });
 
       on_state_change(*this);
     });
index d9a6e3e..d2f6a48 100644 (file)
@@ -119,12 +119,12 @@ void HostImpl::turn_on()
 }
 
 /** Kill all actors hosted here */
 }
 
 /** Kill all actors hosted here */
-void HostImpl::turn_off()
+void HostImpl::turn_off(kernel::actor::ActorImpl* issuer)
 {
   for (auto& actor : actor_list_) {
     XBT_DEBUG("Killing Actor %s@%s on behalf of %s which turned off that host.", actor.get_cname(),
 {
   for (auto& actor : actor_list_) {
     XBT_DEBUG("Killing Actor %s@%s on behalf of %s which turned off that host.", actor.get_cname(),
-              actor.get_host()->get_cname(), SIMIX_process_self()->get_cname());
-    SIMIX_process_self()->kill(&actor);
+              actor.get_host()->get_cname(), issuer->get_cname());
+    issuer->kill(&actor);
   }
   // When a host is turned off, we want to keep only the actors that should restart for when it will boot again.
   // Then get rid of the others.
   }
   // When a host is turned off, we want to keep only the actors that should restart for when it will boot again.
   // Then get rid of the others.
index fa0c5db..fed3f37 100644 (file)
@@ -63,7 +63,7 @@ public:
   s4u::Host* piface_ = nullptr;
 
   void turn_on();
   s4u::Host* piface_ = nullptr;
 
   void turn_on();
-  void turn_off();
+  void turn_off(kernel::actor::ActorImpl* issuer);
   std::vector<s4u::ActorPtr> get_all_actors();
   size_t get_actor_count();
   void add_actor(kernel::actor::ActorImpl* actor) { actor_list_.push_back(*actor); }
   std::vector<s4u::ActorPtr> get_all_actors();
   size_t get_actor_count();
   void add_actor(kernel::actor::ActorImpl* actor) { actor_list_.push_back(*actor); }