From 35e02c75e39b9d81ad7ab1a971e8627d396a8dac Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 14 Mar 2019 23:33:39 +0100 Subject: [PATCH] Restarting or killing maestro does not seem to be a cleaver idea --- src/kernel/actor/ActorImpl.cpp | 4 +++- src/s4u/s4u_Actor.cpp | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kernel/actor/ActorImpl.cpp b/src/kernel/actor/ActorImpl.cpp index 55888daa5a..4569badaab 100644 --- a/src/kernel/actor/ActorImpl.cpp +++ b/src/kernel/actor/ActorImpl.cpp @@ -341,13 +341,15 @@ void ActorImpl::daemonize() 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 - (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 = diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 1b45a6a7e7..836de05be3 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -218,10 +218,8 @@ void Actor::kill() { 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_); }); } -- 2.20.1