Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
inline SIMIX_host_off into s4u::Host->turnOff()
[simgrid.git] / src / simix / smx_host.cpp
index a2cc767..0ff9a9e 100644 (file)
@@ -61,29 +61,6 @@ namespace simgrid {
 
 }} // namespaces
 
-/** @brief Stop the host if it is on */
-void SIMIX_host_off(sg_host_t h, smx_actor_t issuer)
-{
-  simgrid::simix::Host* host = h->extension<simgrid::simix::Host>();
-
-  xbt_assert((host != nullptr), "Invalid parameters");
-
-  if (h->isOn()) {
-    h->pimpl_cpu->turn_off();
-
-    /* Clean Simulator data */
-    if (not host->process_list.empty()) {
-      for (auto& process : host->process_list) {
-        SIMIX_process_kill(&process, issuer);
-        XBT_DEBUG("Killing %s@%s on behalf of %s which turned off that host.", process.get_cname(),
-                  process.host->get_cname(), issuer->get_cname());
-      }
-    }
-  } else {
-    XBT_INFO("Host %s is already off", h->get_cname());
-  }
-}
-
 /* needs to be public and without simcall for exceptions and logging events */
 const char* sg_host_self_get_name()
 {
@@ -210,16 +187,14 @@ void simcall_HANDLER_execution_wait(smx_simcall_t simcall, smx_activity_t synchr
 
 void simcall_HANDLER_execution_test(smx_simcall_t simcall, smx_activity_t synchro)
 {
-  simcall_execution_test__set__result(simcall, (synchro->state_ != SIMIX_WAITING && synchro->state_ != SIMIX_RUNNING));
-  if (simcall_execution_test__get__result(simcall)) {
+  int res = (synchro->state_ != SIMIX_WAITING && synchro->state_ != SIMIX_RUNNING);
+  if (res) {
     synchro->simcalls_.push_back(simcall);
     SIMIX_execution_finish(synchro);
   } else {
     SIMIX_simcall_answer(simcall);
   }
-  /* If the synchro is already finished then perform the error handling */
-  if (synchro->state_ != SIMIX_RUNNING)
-    SIMIX_execution_finish(synchro);
+  simcall_execution_test__set__result(simcall, res);
 }
 
 void SIMIX_execution_finish(smx_activity_t synchro)