Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
new: Actor::get_restart_count(): Returns the number of reboots that this actor did
[simgrid.git] / src / s4u / s4u_Actor.cpp
index ce00aaf..751f333 100644 (file)
@@ -124,8 +124,11 @@ void Actor::join(double timeout) const
 
 Actor* Actor::set_auto_restart(bool autorestart)
 {
+  if (autorestart == pimpl_->has_to_auto_restart()) // not changed
+    return this;
+
   kernel::actor::simcall_answered([this, autorestart]() {
-    xbt_assert(autorestart && not pimpl_->has_to_auto_restart()); // FIXME: handle all cases
+    xbt_assert(autorestart, "Asking an actor to stop being autorestart is not implemented yet. Ask us if you need it.");
     pimpl_->set_auto_restart(autorestart);
 
     auto* arg = new kernel::actor::ProcessArg(pimpl_->get_host(), pimpl_);
@@ -134,6 +137,10 @@ Actor* Actor::set_auto_restart(bool autorestart)
   });
   return this;
 }
+int Actor::get_restart_count()
+{
+  return pimpl_->get_restart_count();
+}
 
 void Actor::on_exit(const std::function<void(bool /*failed*/)>& fun) const
 {