- // TODO, when autorestart is used, the std::function is copied so the new
- // instance will get a fresh (reinitialized) state. Is this what we want?
- this->pimpl_ = SIMIX_process_ref(simcall_process_create(
- name, std::move(code), nullptr, host->name().c_str(),
- killTime, nullptr, 0));
+ smx_context_t self_context = SIMIX_context_self();
+ if (self_context == nullptr)
+ return simgrid::s4u::ActorPtr();
+
+ return self_context->process()->iface();
+}
+
+ActorPtr Actor::createActor(const char* name, s4u::Host* host, std::function<void()> code)
+{
+ smx_actor_t actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+ return actor->iface();