/* 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. */
-#include "simgrid/s4u/Actor.hpp"
-#include "mc/mc.h"
-#include "simgrid/Exception.hpp"
-#include "simgrid/s4u/Exec.hpp"
+#include <simgrid/Exception.hpp>
+#include <simgrid/s4u/Actor.hpp>
+#include <simgrid/s4u/Host.hpp>
+
#include "src/kernel/EngineImpl.hpp"
-#include "src/kernel/activity/CommImpl.hpp"
-#include "src/kernel/activity/ExecImpl.hpp"
-#include "src/kernel/activity/IoImpl.hpp"
-#include "src/kernel/activity/SleepImpl.hpp"
-#include "src/kernel/activity/SynchroRaw.hpp"
-#include "src/mc/mc_replay.hpp"
-#include "src/mc/remote/AppSide.hpp"
#if HAVE_SMPI
#include "src/smpi/include/private.hpp"
#endif
#include "src/surf/HostImpl.hpp"
-#include "src/surf/cpu_interface.hpp"
#include <boost/core/demangle.hpp>
#include <typeinfo>
*
* @return The SIMIX process
*/
-smx_actor_t SIMIX_process_self()
+smx_actor_t SIMIX_process_self() // XBT_ATTRIB_DEPRECATED_v333
{
return simgrid::kernel::actor::ActorImpl::self();
}
ActorImpl::~ActorImpl()
{
- if (not EngineImpl::get_instance()->is_maestro(this))
+ if (EngineImpl::has_instance() && not EngineImpl::get_instance()->is_maestro(this))
s4u::Actor::on_destruction(*get_ciface());
}
void ActorImpl::kill(ActorImpl* actor) const
{
- xbt_assert(not EngineImpl::get_instance()->is_maestro(actor), "Killing maestro is a rather bad idea");
+ auto* engine = EngineImpl::get_instance();
+ xbt_assert(not engine->is_maestro(actor), "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());
if (actor == this) {
XBT_DEBUG("Go on, this is a suicide,");
} else
- EngineImpl::get_instance()->add_actor_to_run_list(actor);
+ engine->add_actor_to_run_list(actor);
}
void ActorImpl::kill_all() const
}
maestro->simcall_.issuer_ = maestro;
- EngineImpl::get_instance()->set_maestro(maestro);
+ engine->set_maestro(maestro);
}
} // namespace actor
} // namespace kernel
} // namespace simgrid
-/* needs to be public and without simcall because it is called
- by exceptions and logging events */
-const char* SIMIX_process_self_get_name()
+/* needs to be public and without simcall because it is called by exceptions and logging events */
+const char* SIMIX_process_self_get_name() // XBT_ATTRIB_DEPRECATED_v333
{
return SIMIX_is_maestro() ? "maestro" : simgrid::kernel::actor::ActorImpl::self()->get_cname();
}
{
return simgrid::kernel::actor::ActorImpl::by_pid(pid);
}
+
+int SIMIX_is_maestro()
+{
+ const auto* self = simgrid::kernel::actor::ActorImpl::self();
+ return self == nullptr || simgrid::kernel::EngineImpl::get_instance()->is_maestro(self);
+}