Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Restarting or killing maestro does not seem to be a cleaver idea
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 14 Mar 2019 22:33:39 +0000 (23:33 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 14 Mar 2019 22:57:57 +0000 (23:57 +0100)
src/kernel/actor/ActorImpl.cpp
src/s4u/s4u_Actor.cpp

index 55888da..4569bad 100644 (file)
@@ -341,13 +341,15 @@ void ActorImpl::daemonize()
 
 s4u::Actor* ActorImpl::restart()
 {
 
 s4u::Actor* ActorImpl::restart()
 {
+  xbt_assert(this != simix_global->maestro_process, "Restarting maestro is not supported");
+
   XBT_DEBUG("Restarting actor %s on %s", get_cname(), host_->get_cname());
 
   // retrieve the arguments of the old actor
   ProcessArg arg = ProcessArg(host_, this);
 
   // kill the old actor
   XBT_DEBUG("Restarting actor %s on %s", get_cname(), host_->get_cname());
 
   // retrieve the arguments of the old actor
   ProcessArg arg = ProcessArg(host_, this);
 
   // kill the old actor
-  (this == simix_global->maestro_process) ? this->exit() : SIMIX_process_self()->kill(this);
+  context::Context::self()->get_actor()->kill(this);
 
   // start the new actor
   ActorImplPtr actor =
 
   // start the new actor
   ActorImplPtr actor =
index 1b45a6a..836de05 100644 (file)
@@ -218,10 +218,8 @@ void Actor::kill()
 {
   kernel::actor::ActorImpl* process = SIMIX_process_self();
   simix::simcall([this, process] {
 {
   kernel::actor::ActorImpl* process = SIMIX_process_self();
   simix::simcall([this, process] {
-    if (pimpl_ == simix_global->maestro_process)
-      pimpl_->exit();
-    else
-      process->kill(pimpl_);
+    xbt_assert(pimpl_ != simix_global->maestro_process, "Killing maestro is a rather bad idea");
+    process->kill(pimpl_);
   });
 }
 
   });
 }