From: Arnaud Giersch Date: Thu, 3 May 2018 09:02:49 +0000 (+0200) Subject: Modernize simcall process_killall. X-Git-Tag: v3.20~299 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/28cf1594ef109bb3cd215fd9b0f16a5418ca999e Modernize simcall process_killall. --- diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 3b75af828c..7c50946ca1 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -189,7 +189,6 @@ XBT_PUBLIC smx_actor_t simcall_process_create(const char* name, xbt_main_func_t int argc, char** argv, std::map* properties); #endif -XBT_PUBLIC void simcall_process_killall(); XBT_PUBLIC void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char* mesg); /* Process handling */ diff --git a/src/msg/msg_global.cpp b/src/msg/msg_global.cpp index 70480e1203..cf4cda0d36 100644 --- a/src/msg/msg_global.cpp +++ b/src/msg/msg_global.cpp @@ -3,6 +3,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "simgrid/s4u/Actor.hpp" #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/Host.hpp" @@ -91,8 +92,7 @@ void MSG_config(const char *key, const char *value){ */ int MSG_process_killall() { - simcall_process_killall(); - + simgrid::s4u::Actor::kill_all(); return 0; } diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index c4ac6914e5..2228a91273 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -225,7 +225,8 @@ ActorPtr Actor::by_pid(aid_t pid) void Actor::kill_all() { - simcall_process_killall(); + smx_actor_t self = SIMIX_process_self(); + simgrid::simix::kernelImmediate([&self] { SIMIX_process_killall(self); }); } std::map* Actor::get_properties() diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 26ad38bb75..cbf5b96f85 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -565,10 +565,6 @@ void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const } -void simcall_HANDLER_process_killall(smx_simcall_t simcall) -{ - SIMIX_process_killall(simcall->issuer); -} /** * \brief Kills all running processes. * \param issuer this one will not be killed diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 254652cf35..d685e4bce3 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -177,15 +177,6 @@ e_smx_state_t simcall_execution_test(smx_activity_t execution) return (e_smx_state_t)simcall_BODY_execution_test(execution); } -/** - * \ingroup simix_process_management - * \brief Kills all SIMIX processes. - */ -void simcall_process_killall() -{ - simcall_BODY_process_killall(); -} - void simcall_process_join(smx_actor_t process, double timeout) { simcall_BODY_process_join(process, timeout); diff --git a/src/simix/popping_accessors.hpp b/src/simix/popping_accessors.hpp index 698a84adf6..5d8c7d1ae1 100644 --- a/src/simix/popping_accessors.hpp +++ b/src/simix/popping_accessors.hpp @@ -1347,7 +1347,6 @@ static inline void simcall_run_blocking__set__code(smx_simcall_t simcall, std::f /* The prototype of all simcall handlers, automatically generated for you */ -XBT_PRIVATE void simcall_HANDLER_process_killall(smx_simcall_t simcall); XBT_PRIVATE void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t process); XBT_PRIVATE void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout); XBT_PRIVATE void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration); diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index 458aa720cb..c0f8318125 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -37,13 +37,6 @@ inline static R simcall(e_smx_simcall_t call, T const&... t) return simgrid::simix::unmarshal(self->simcall.result); } -inline static void simcall_BODY_process_killall() -{ - if (0) /* Go to that function to follow the code flow through the simcall barrier */ - simcall_HANDLER_process_killall(&SIMIX_process_self()->simcall); - return simcall(SIMCALL_PROCESS_KILLALL); -} - inline static void simcall_BODY_process_suspend(smx_actor_t process) { if (0) /* Go to that function to follow the code flow through the simcall barrier */ diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index 6cfa5c1dea..2c83ae22bd 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -19,7 +19,6 @@ */ typedef enum { SIMCALL_NONE, - SIMCALL_PROCESS_KILLALL, SIMCALL_PROCESS_SUSPEND, SIMCALL_PROCESS_JOIN, SIMCALL_PROCESS_SLEEP, diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index dcf20937e4..d4502d96b8 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -28,7 +28,6 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping); /** @brief Simcalls' names (generated from src/simix/simcalls.in) */ const char* simcall_names[] = { "SIMCALL_NONE", - "SIMCALL_PROCESS_KILLALL", "SIMCALL_PROCESS_SUSPEND", "SIMCALL_PROCESS_JOIN", "SIMCALL_PROCESS_SLEEP", @@ -73,11 +72,6 @@ void SIMIX_simcall_handle(smx_simcall_t simcall, int value) { if (simcall->issuer->context->iwannadie) return; switch (simcall->call) { -case SIMCALL_PROCESS_KILLALL: - simcall_HANDLER_process_killall(simcall); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_PROCESS_SUSPEND: simcall_HANDLER_process_suspend(simcall, simgrid::simix::unmarshal(simcall->args[0])); break; diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index aeda3cd11f..08017327a1 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -35,7 +35,6 @@ # Last but not the least, you should declare the new simix call in # ./include/simgrid/simix.h (otherwise you will get a warning at compile time) -void process_killall(); void process_suspend(smx_actor_t process) [[block]]; int process_join(smx_actor_t process, double timeout) [[block]]; int process_sleep(double duration) [[block]];