// ***** Methods *****
/** This actor will be automatically terminated when the last non-daemon actor finishes **/
- void daemonize();
+ Actor* daemonize();
/** Returns whether or not this actor has been daemonized or not **/
bool is_daemon() const;
bool is_suspended() const;
/** If set to true, the actor will automatically restart when its host reboots */
- void set_auto_restart(bool autorestart);
+ Actor* set_auto_restart(bool autorestart);
/** Add a function to the list of "on_exit" functions for the current actor. The on_exit functions are the functions
* executed when your actor is killed. You should use them to free the data used by your actor.
});
}
-void Actor::set_auto_restart(bool autorestart)
+Actor* Actor::set_auto_restart(bool autorestart)
{
kernel::actor::simcall([this, autorestart]() {
xbt_assert(autorestart && not pimpl_->has_to_auto_restart()); // FIXME: handle all cases
XBT_DEBUG("Adding %s to the actors_at_boot_ list of Host %s", arg->name.c_str(), arg->host->get_cname());
pimpl_->get_host()->get_impl()->add_actor_at_boot(arg);
});
+ return this;
}
void Actor::on_exit(const std::function<void(bool /*failed*/)>& fun) const
return this->pimpl_->get_host();
}
-void Actor::daemonize()
+Actor* Actor::daemonize()
{
kernel::actor::simcall([this]() { pimpl_->daemonize(); });
+ return this;
}
bool Actor::is_daemon() const