From 361da673f9e66e13ce1ef5f21bc395439606c170 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Mon, 27 Sep 2021 12:07:09 +0200 Subject: [PATCH] Mark the smpi_exit call as noreturn, and really kill the process when exit is called Thanks agier --- include/smpi/smpi_helpers_internal.h | 2 +- src/smpi/internals/smpi_global.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/smpi/smpi_helpers_internal.h b/include/smpi/smpi_helpers_internal.h index 929d22e75e..a55d1281b6 100644 --- a/include/smpi/smpi_helpers_internal.h +++ b/include/smpi/smpi_helpers_internal.h @@ -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 diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 13c6a3be99..65453e410e 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -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 } -- 2.20.1