+namespace simgrid {
+namespace s4u {
+
+// ***** Actor creation *****
+ActorPtr Actor::self()
+{
+ 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)
+{
+ simgrid::simix::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+ return actor->iface();
+}
+
+ActorPtr Actor::createActor(const char* name, s4u::Host* host, const char* function, std::vector<std::string> args)
+{
+ simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
+ simgrid::simix::ActorCode code = factory(std::move(args));
+ simgrid::simix::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+ return actor->iface();
+}
+
+void intrusive_ptr_add_ref(Actor* actor)
+{
+ xbt_assert(actor != nullptr);
+ intrusive_ptr_add_ref(actor->pimpl_);
+}
+void intrusive_ptr_release(Actor* actor)
+{
+ xbt_assert(actor != nullptr);
+ intrusive_ptr_release(actor->pimpl_);
+}
+
+// ***** Actor methods *****
+
+void Actor::join() {
+ simcall_process_join(this->pimpl_, -1);
+}
+
+void Actor::setAutoRestart(bool autorestart) {
+ simgrid::simix::kernelImmediate([this, autorestart]() { pimpl_->auto_restart = autorestart; });
+}
+
+void Actor::onExit(int_f_pvoid_pvoid_t fun, void* data)
+{
+ simcall_process_on_exit(pimpl_, fun, data);
+}
+
+void Actor::migrate(Host* new_host)
+{
+ simgrid::simix::kernelImmediate([this, new_host]() { pimpl_->new_host = new_host; });
+}
+
+s4u::Host* Actor::getHost()