#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);
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;
}
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_) {