actor->set_properties(*properties);
/* Add the process to it's host process list */
- host->pimpl_->process_list_.push_back(*actor);
+ host->pimpl_->add_actor(actor);
/* Now insert it in the global process list and in the process to run list */
simix_global->process_list[actor->get_pid()] = actor;
simix_global->mutex.lock();
simix_global->process_list.erase(pid_);
- if (host_ && host_process_list_hook.is_linked())
- simgrid::xbt::intrusive_erase(host_->pimpl_->process_list_, *this);
+ if (host_ && host_actor_list_hook.is_linked())
+ host_->pimpl_->remove_actor(this);
if (not smx_destroy_list_hook.is_linked()) {
#if SIMGRID_HAVE_MC
xbt_dynar_push_as(simix_global->dead_actors_vector, ActorImpl*, this);
void ActorImpl::kill(ActorImpl* actor)
{
+ xbt_assert(actor != simix_global->maestro_process, "Killing maestro is a rather bad idea");
if (actor->finished_) {
XBT_DEBUG("Ignoring request to kill actor %s@%s that is already dead", actor->get_cname(),
actor->host_->get_cname());
void ActorImpl::set_host(s4u::Host* dest)
{
- xbt::intrusive_erase(host_->pimpl_->process_list_, *this);
+ host_->pimpl_->remove_actor(this);
host_ = dest;
- dest->pimpl_->process_list_.push_back(*this);
+ dest->pimpl_->add_actor(this);
}
ActorImplPtr ActorImpl::init(const std::string& name, s4u::Host* host)
XBT_DEBUG("Start context '%s'", get_cname());
/* Add the actor to its host's actor list */
- host_->pimpl_->process_list_.push_back(*this);
+ host_->pimpl_->add_actor(this);
simix_global->process_list[pid_] = this;
/* Now insert it in the global actor list and in the actor to run list */
by exceptions and logging events */
const char* SIMIX_process_self_get_name()
{
-
- smx_actor_t process = SIMIX_process_self();
- if (process == nullptr || process == simix_global->maestro_process)
- return "maestro";
-
- return process->get_cname();
+ return SIMIX_is_maestro() ? "maestro" : SIMIX_process_self()->get_cname();
}
/**