Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Mark the smpi_exit call as noreturn, and really kill the process when exit is called
authorAugustin Degomme <adegomme@users.noreply.github.com>
Mon, 27 Sep 2021 10:07:09 +0000 (12:07 +0200)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Mon, 27 Sep 2021 10:07:09 +0000 (12:07 +0200)
Thanks agier

include/smpi/smpi_helpers_internal.h
src/smpi/internals/smpi_global.cpp

index 929d22e..a55d128 100644 (file)
@@ -38,7 +38,7 @@ void* smpi_shared_malloc_intercept(size_t size, const char* file, int line);
 void* smpi_shared_calloc_intercept(size_t num_elm, size_t elem_size, const char* file, int line);
 void* smpi_shared_realloc_intercept(void* data, size_t size, const char* file, int line);
 void smpi_shared_free(void* data);
-void smpi_exit(int status);
+void __attribute__((noreturn)) smpi_exit(int status);
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 13c6a3b..65453e4 100644 (file)
@@ -636,8 +636,11 @@ void SMPI_thread_create() {
   smpi_process()->mark_as_initialized();
 }
 
-void smpi_exit(int x){
-  if(x!=0)
-    smpi_exit_status = x;
-  return;
+void smpi_exit(int res){
+  if(res != 0){
+    XBT_WARN("SMPI process did not return 0. Return value : %d", res);
+    smpi_exit_status = res;
+  }
+  simgrid::s4u::this_actor::exit();
+  while(1);//necessary for the noreturn attribute
 }