-/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
engine->remove_actor(pid_);
if (host_ && host_actor_list_hook.is_linked())
host_->get_impl()->remove_actor(this);
- if (not kernel_destroy_list_hook.is_linked()) {
-#if SIMGRID_HAVE_MC
- engine->add_dead_actor_to_dynar(this);
-#endif
+ if (not kernel_destroy_list_hook.is_linked())
engine->add_actor_to_destroy_list(*this);
- }
}
void ActorImpl::cleanup()
activity->cancel();
activities_.clear();
+ while (not mailboxes.empty())
+ mailboxes.back()->set_receiver(nullptr);
+
XBT_DEBUG("%s@%s(%ld) should not run anymore", get_cname(), get_host()->get_cname(), get_pid());
if (EngineImpl::get_instance()->is_maestro(this)) /* Do not cleanup maestro */
cleanup_from_simix();
context_->set_wannadie(false); // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops
- actor::simcall([this] { s4u::Actor::on_termination(*get_ciface()); });
+ actor::simcall_answered([this] { s4u::Actor::on_termination(*get_ciface()); });
context_->set_wannadie();
}
exception_ = nullptr;
/* destroy the blocking synchro if any */
- if (waiting_synchro_ != nullptr) {
- waiting_synchro_->cancel();
- waiting_synchro_->state_ = activity::State::FAILED;
-
- activity::ExecImplPtr exec = boost::dynamic_pointer_cast<activity::ExecImpl>(waiting_synchro_);
- activity::CommImplPtr comm = boost::dynamic_pointer_cast<activity::CommImpl>(waiting_synchro_);
-
- if (exec != nullptr) {
- exec->clean_action();
- } else if (comm != nullptr) {
- comm->unregister_simcall(&simcall_);
- } else {
- activity::ActivityImplPtr(waiting_synchro_)->finish();
- }
-
+ if (auto activity = waiting_synchro_) {
activities_.remove(waiting_synchro_);
waiting_synchro_ = nullptr;
+
+ activity->cancel();
+ activity->set_state(activity::State::FAILED);
+ activity->post();
}
for (auto const& activity : activities_)
activity->cancel();
activities_.clear();
+ while (not mailboxes.empty())
+ mailboxes.back()->set_receiver(nullptr);
+
// Forcefully kill the actor if its host is turned off. Not a HostFailureException because you should not survive that
this->throw_exception(std::make_exception_ptr(ForcefulKillException(host_->is_on() ? "exited" : "host failed")));
}
/* Go into sleep and return control to maestro */
context_->suspend();
-
/* Ok, maestro returned control to us */
XBT_DEBUG("Control returned to me: '%s'", get_cname());
e.rethrow_nested(XBT_THROW_POINT, boost::core::demangle(typeid(e).name()) + " raised in kernel mode.");
}
}
-
#if HAVE_SMPI
if (not finished_)
smpi_switch_data_segment(get_iface());
return simgrid::s4u::Actor::is_maestro() ? "maestro" : simgrid::kernel::actor::ActorImpl::self()->get_cname();
}
-/** @brief Returns the process from PID. */
-smx_actor_t SIMIX_process_from_PID(aid_t pid) // XBT_ATTRIB_DEPRECATED_v331
-{
- return simgrid::kernel::actor::ActorImpl::by_pid(pid);
-}
-
int SIMIX_is_maestro() // XBT_ATTRIB_DEPRECATED_v333
{
const auto* self = simgrid::kernel::actor::ActorImpl::self();