- 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());
- }
-
- actor_->finished_ = true;
- SIMIX_process_on_exit_runall(actor_);
-
- /* cancel non-blocking activities */
- for (auto activity : actor_->comms)
- boost::static_pointer_cast<activity::CommImpl>(activity)->cancel();
- actor_->comms.clear();
-
- XBT_DEBUG("%s@%s(%ld) should not run anymore", actor_->get_cname(), actor_->iface()->get_host()->get_cname(),
- actor_->pid_);
-
- if (this->cleanup_func_)
- this->cleanup_func_(this->actor_);
-
- this->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), because that's me
- simgrid::simix::simcall([this] { SIMIX_process_cleanup(this->actor_); });
- this->iwannadie = true;
+ this->actor_->cleanup_from_self();
+ sthread_disable();
+ throw ForcefulKillException(); // clean RAII variables with the dedicated exception