*
* @return The SIMIX process
*/
-smx_actor_t SIMIX_process_self() // XBT_ATTRIB_DEPRECATED_v333
+simgrid::kernel::actor::ActorImpl* SIMIX_process_self() // XBT_ATTRIB_DEPRECATED_v333
{
return simgrid::kernel::actor::ActorImpl::self();
}
{
return &maxpid;
}
-ActorIDTrait::ActorIDTrait(std::string name, aid_t ppid) : name_(std::move(name)), pid_(maxpid++), ppid_(ppid) {}
+ActorIDTrait::ActorIDTrait(const std::string& name, aid_t ppid) : name_(name), pid_(maxpid++), ppid_(ppid) {}
ActorImpl* ActorImpl::self()
{
void ActorImpl::cleanup_from_kernel()
{
- xbt_assert(s4u::Actor::is_maestro(), "Cleanup_from_kernel called from '%s' on '%s'", ActorImpl::self()->get_cname(),
- get_cname());
+ xbt_assert(s4u::Actor::is_maestro(), "Cleanup_from_kernel must be called in maestro context");
auto* engine = EngineImpl::get_instance();
+ if (engine->get_actor_by_pid(get_pid()) == nullptr)
+ return; // Already cleaned
+
engine->remove_actor(get_pid());
if (host_ && host_actor_list_hook.is_linked())
host_->get_impl()->remove_actor(this);
}
undaemonize();
+ s4u::Actor::on_termination(*get_ciface());
while (not mailboxes_.empty())
mailboxes_.back()->set_receiver(nullptr);
simcall_.timeout_cb_ = nullptr;
}
- set_wannadie(false); // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops
- actor::simcall_answered([this] { s4u::Actor::on_termination(*get_ciface()); });
+ /* maybe the actor was killed during a simcall, reset its observer */
+ simcall_.observer_ = nullptr;
+
set_wannadie();
}