/* Now insert it in the global actor list and in the actors to run list */
simix_global->process_list[actor->get_pid()] = actor;
- XBT_DEBUG("Inserting [%p] %s(%s) in the to_run list", actor, actor->get_cname(), host->get_cname());
- simix_global->actors_to_run.push_back(actor);
+ EngineImpl::get_instance()->add_actor_to_run_list_no_check(actor);
intrusive_ptr_add_ref(actor);
auto* context = dynamic_cast<context::AttachContext*>(actor->context_.get());
if (actor == this) {
XBT_DEBUG("Go on, this is a suicide,");
- } else if (std::find(begin(simix_global->actors_to_run), end(simix_global->actors_to_run), actor) !=
- end(simix_global->actors_to_run)) {
- XBT_DEBUG("Actor %s is already in the to_run list", actor->get_cname());
- } else {
- XBT_DEBUG("Inserting %s in the to_run list", actor->get_cname());
- simix_global->actors_to_run.push_back(actor);
- }
+ } else
+ EngineImpl::get_instance()->add_actor_to_run_list(actor);
}
void ActorImpl::kill_all() const
for (auto const& activity : activities_)
activity->resume();
if (not waiting_synchro_) // Reschedule the actor if it was forcefully unscheduled in yield()
- simix_global->actors_to_run.push_back(this);
+ EngineImpl::get_instance()->add_actor_to_run_list_no_check(this);
XBT_OUT();
}
XBT_DEBUG("Answer simcall %s issued by %s (%p)", SIMIX_simcall_name(simcall_), get_cname(), this);
xbt_assert(simcall_.call_ != simix::Simcall::NONE);
simcall_.call_ = simix::Simcall::NONE;
+ auto* engine = EngineImpl::get_instance();
+ const auto& actors_to_run = engine->get_actors_to_run();
xbt_assert(not XBT_LOG_ISENABLED(simix_process, xbt_log_priority_debug) ||
- std::find(begin(simix_global->actors_to_run), end(simix_global->actors_to_run), this) ==
- end(simix_global->actors_to_run),
+ std::find(begin(actors_to_run), end(actors_to_run), this) == end(actors_to_run),
"Actor %p should not exist in actors_to_run!", this);
- simix_global->actors_to_run.push_back(this);
+ engine->add_actor_to_run_list_no_check(this);
}
}
simix_global->process_list[pid_] = this;
/* Now insert it in the global actor list and in the actor to run list */
- XBT_DEBUG("Inserting [%p] %s(%s) in the to_run list", this, get_cname(), host_->get_cname());
- simix_global->actors_to_run.push_back(this);
+ EngineImpl::get_instance()->add_actor_to_run_list_no_check(this);
return this;
}