Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify SIMIX_host_add_auto_restart_process
[simgrid.git] / src / simix / smx_host.cpp
index 3a22697..3e565cb 100644 (file)
@@ -55,7 +55,7 @@ namespace simgrid {
         if (arg->kill_time >= 0)
           simcall_process_set_kill_time(actor, arg->kill_time);
         if (arg->auto_restart)
-          actor->auto_restart = arg->auto_restart;
+          actor->auto_restart_ = arg->auto_restart;
       }
     }
 
@@ -78,13 +78,9 @@ const char* sg_host_self_get_name()
  * The processes will only be restarted once, meaning that you will have to register the process
  * again to restart the process again.
  */
-void SIMIX_host_add_auto_restart_process(sg_host_t host, const char* name, std::function<void()> code, void* data,
-                                         double kill_time, std::map<std::string, std::string>* properties,
-                                         int auto_restart)
+void SIMIX_host_add_auto_restart_process(sg_host_t host, simgrid::kernel::actor::ActorImpl* actor)
 {
-  simgrid::kernel::actor::ProcessArg* arg =
-      new simgrid::kernel::actor::ProcessArg(name, code, data, host, kill_time, nullptr, auto_restart);
-  arg->properties.reset(properties, [](decltype(properties)) {});
+  simgrid::kernel::actor::ProcessArg* arg = new simgrid::kernel::actor::ProcessArg(host, actor);
 
   if (host->is_off() && watched_hosts.find(host->get_cname()) == watched_hosts.end()) {
     watched_hosts.insert(host->get_cname());
@@ -107,7 +103,7 @@ void SIMIX_host_autorestart(sg_host_t host)
     if (arg->kill_time >= 0)
       simcall_process_set_kill_time(actor, arg->kill_time);
     if (arg->auto_restart)
-      actor->auto_restart = arg->auto_restart;
+      actor->auto_restart_ = arg->auto_restart;
   }
   process_list.clear();
 }
@@ -213,8 +209,8 @@ void SIMIX_execution_finish(smx_activity_t synchro)
         break;
 
       case SIMIX_FAILED:
-        XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host->get_cname());
-        simcall->issuer->context->iwannadie = 1;
+        XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host_->get_cname());
+        simcall->issuer->context_->iwannadie = 1;
         SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
         break;
 
@@ -232,8 +228,8 @@ void SIMIX_execution_finish(smx_activity_t synchro)
         xbt_die("Internal error in SIMIX_execution_finish: unexpected synchro state %d", (int)exec->state_);
     }
     /* Fail the process if the host is down */
-    if (simcall->issuer->host->is_off())
-      simcall->issuer->context->iwannadie = 1;
+    if (simcall->issuer->host_->is_off())
+      simcall->issuer->context_->iwannadie = 1;
 
     simcall->issuer->waiting_synchro = nullptr;
     simcall_execution_wait__set__result(simcall, exec->state_);