Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Simplify the actor answer to iwannadie
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 21 Jan 2019 16:01:14 +0000 (17:01 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 22 Jan 2019 17:07:01 +0000 (18:07 +0100)
src/kernel/context/Context.cpp
src/simix/ActorImpl.cpp

index 9415e8d..06e5402 100644 (file)
@@ -5,8 +5,10 @@
 
 #include "mc/mc.h"
 
+#include "simgrid/s4u/Host.hpp"
 #include "src/kernel/context/Context.hpp"
 #include "src/simix/smx_private.hpp"
+#include "src/surf/surf_interface.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
 
@@ -81,10 +83,18 @@ Context::~Context()
 
 void Context::stop()
 {
+  actor_->finished_ = true;
+
+  if (actor_->auto_restart_ && actor_->host_->is_off()) {
+    XBT_DEBUG("Insert host %s to watched_hosts because it's off and %s needs to restart", actor_->host_->get_cname(),
+              actor_->get_cname());
+    watched_hosts.insert(actor_->host_->get_cname());
+  }
+
   if (this->cleanup_func_)
     this->cleanup_func_(this->actor_);
 
-  this->iwannadie = false;
+  this->iwannadie = false; // don't let the yield call ourself -- Context::stop()
   simgrid::simix::simcall([this] { SIMIX_process_cleanup(this->actor_); });
   this->iwannadie = true;
 }
index 37547d7..8071b9c 100644 (file)
@@ -741,22 +741,10 @@ void SIMIX_process_yield(smx_actor_t self)
   XBT_DEBUG("Control returned to me: '%s'", self->get_cname());
 
   if (self->context_->iwannadie) {
-    XBT_DEBUG("I wanna die!");
-    self->finished_ = true;
-    /* execute the on_exit functions */
-    SIMIX_process_on_exit_runall(self);
-
-    if (self->auto_restart_ && self->host_->is_off() &&
-        watched_hosts.find(self->host_->get_cname()) == watched_hosts.end()) {
-      XBT_DEBUG("Push host %s to watched_hosts because it's off and %s needs to restart", self->host_->get_cname(),
-                self->get_cname());
-      watched_hosts.insert(self->host_->get_cname());
-    }
 
     XBT_DEBUG("Process %s@%s is dead", self->get_cname(), self->host_->get_cname());
     self->context_->stop();
-    xbt_backtrace_display_current();
-    xbt_die("I should be dead by now.");
+    THROW_IMPOSSIBLE;
   }
 
   if (self->suspended_) {