Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove an useless pimple around exceptions
[simgrid.git] / src / simix / smx_process.cpp
index 46007fb..2fb0858 100644 (file)
@@ -11,7 +11,7 @@
 #include "xbt/dict.h"
 #include "mc/mc.h"
 #include "src/mc/mc_replay.h"
-#include "src/mc/mc_client.h"
+#include "src/mc/Client.hpp"
 #include "src/simix/smx_private.hpp"
 #include "src/msg/msg_private.h"
 
@@ -189,7 +189,7 @@ void SIMIX_process_stop(smx_process_t arg) {
   /* execute the on_exit functions */
   SIMIX_process_on_exit_runall(arg);
   /* Add the process to the list of process to restart, only if the host is down */
-  if (arg->auto_restart && arg->host->is_off()) {
+  if (arg->auto_restart && arg->host->isOff()) {
     SIMIX_host_add_auto_restart_process(arg->host,arg->name,arg->code, arg->data,
                                         sg_host_get_name(arg->host),
                                         SIMIX_timer_get_date(arg->kill_timer),
@@ -268,7 +268,7 @@ smx_process_t SIMIX_process_create(
 
   XBT_DEBUG("Start process %s on host '%s'", name, hostname);
 
-  if (host->is_off()) {
+  if (host->isOff()) {
     int i;
     XBT_WARN("Cannot launch process '%s' on failed host '%s'", name,
           hostname);
@@ -294,7 +294,7 @@ smx_process_t SIMIX_process_create(
        process->ppid = SIMIX_process_get_PID(parent_process);
        /* SMPI process have their own data segment and
           each other inherit from their father */
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
        if(smpi_privatize_global_variables){
          if( parent_process->pid != 0){
            SIMIX_segment_index_set(process, parent_process->segment_index);
@@ -362,7 +362,7 @@ smx_process_t SIMIX_process_attach(
   sg_host_t host = sg_host_by_name(hostname);
   XBT_DEBUG("Attach process %s on host '%s'", name, hostname);
 
-  if (host->is_off()) {
+  if (host->isOff()) {
     XBT_WARN("Cannot launch process '%s' on failed host '%s'",
       name, hostname);
     return nullptr;
@@ -383,7 +383,7 @@ smx_process_t SIMIX_process_attach(
     process->ppid = SIMIX_process_get_PID(parent_process);
    /* SMPI process have their own data segment and
       each other inherit from their father */
-  #ifdef HAVE_SMPI
+  #if HAVE_SMPI
     if(smpi_privatize_global_variables){
       if(parent_process->pid != 0){
         SIMIX_segment_index_set(process, parent_process->segment_index);
@@ -768,9 +768,9 @@ int SIMIX_process_get_PPID(smx_process_t self){
     return self->ppid;
 }
 
-void* SIMIX_process_self_get_data(smx_process_t self)
+void* SIMIX_process_self_get_data()
 {
-  xbt_assert(self == SIMIX_process_self(), "This is not the current process");
+  smx_process_t self = SIMIX_process_self();
 
   if (!self) {
     return NULL;
@@ -778,9 +778,9 @@ void* SIMIX_process_self_get_data(smx_process_t self)
   return SIMIX_process_get_data(self);
 }
 
-void SIMIX_process_self_set_data(smx_process_t self, void *data)
+void SIMIX_process_self_set_data(void *data)
 {
-  xbt_assert(self == SIMIX_process_self(), "This is not the current process");
+  smx_process_t self = SIMIX_process_self();
 
   SIMIX_process_set_data(self, data);
 }
@@ -898,7 +898,7 @@ smx_synchro_t SIMIX_process_sleep(smx_process_t process, double duration)
   sg_host_t host = process->host;
 
   /* check if the host is active */
-  if (host->is_off()) {
+  if (host->isOff()) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -926,13 +926,13 @@ void SIMIX_post_process_sleep(smx_synchro_t synchro)
   while ((simcall = (smx_simcall_t) xbt_fifo_shift(synchro->simcalls))) {
 
     switch (synchro->sleep.surf_sleep->getState()){
-      case SURF_ACTION_FAILED:
+      case simgrid::surf::Action::State::failed:
         simcall->issuer->context->iwannadie = 1;
         //SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
         state = SIMIX_SRC_HOST_FAILURE;
         break;
 
-      case SURF_ACTION_DONE:
+      case simgrid::surf::Action::State::done:
         state = SIMIX_DONE;
         break;
 
@@ -940,7 +940,7 @@ void SIMIX_post_process_sleep(smx_synchro_t synchro)
         THROW_IMPOSSIBLE;
         break;
     }
-    if (simcall->issuer->host->is_off()) {
+    if (simcall->issuer->host->isOff()) {
       simcall->issuer->context->iwannadie = 1;
     }
     simcall_process_sleep__set__result(simcall, state);
@@ -1021,7 +1021,7 @@ void SIMIX_process_yield(smx_process_t self)
   if (self->doexception) {
     XBT_DEBUG("Wait, maestro left me an exception");
     self->doexception = 0;
-    SMX_THROW();
+    RETHROW;
   }
 
   if(SMPI_switch_data_segment && self->segment_index != -1){