#include "src/include/mc/mc.h"
#include "src/kernel/activity/ExecImpl.hpp"
#include "src/mc/mc_replay.hpp"
-#include "src/simix/smx_private.hpp"
#include "src/surf/HostImpl.hpp"
#include <algorithm>
return self_context->get_actor()->ciface();
}
+
ActorPtr Actor::init(const std::string& name, s4u::Host* host)
{
kernel::actor::ActorImpl* self = SIMIX_process_self();
void Actor::kill()
{
kernel::actor::ActorImpl* self = SIMIX_process_self();
- kernel::actor::simcall([this, self] {
- xbt_assert(pimpl_ != simix_global->maestro_process, "Killing maestro is a rather bad idea");
- self->kill(pimpl_);
- });
+ kernel::actor::simcall([this, self] { self->kill(pimpl_); });
}
// ***** Static functions *****
*/
bool is_maestro()
{
- kernel::actor::ActorImpl* self = SIMIX_process_self();
- return self == nullptr || self == simix_global->maestro_process;
+ return SIMIX_is_maestro();
}
void sleep_for(double duration)
/* **************************** Public C interface *************************** */
+sg_actor_t sg_actor_init(const char* name, sg_host_t host)
+{
+ return simgrid::s4u::Actor::init(name, host).get();
+}
+
+void sg_actor_start(sg_actor_t actor, xbt_main_func_t code, int argc, char** argv)
+{
+ simgrid::simix::ActorCode function;
+ if (code)
+ function = simgrid::xbt::wrap_main(code, argc, static_cast<const char* const*>(argv));
+ actor->start(std::move(function));
+}
+
/** @ingroup m_actor_management
* @brief Returns the process ID of @a actor.
*
if (props == nullptr)
return nullptr;
for (auto const& kv : *props) {
- xbt_dict_set(as_dict, kv.first.c_str(), xbt_strdup(kv.second.c_str()), nullptr);
+ xbt_dict_set(as_dict, kv.first.c_str(), xbt_strdup(kv.second.c_str()));
}
return as_dict;
}