simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host, int argc, char** argv,
std::map<std::string, std::string>* properties);
-XBT_PUBLIC(void) simcall_process_kill(smx_actor_t process);
XBT_PUBLIC(void) simcall_process_killall(int reset_pid);
XBT_PUBLIC(void) SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char *msg);
{
smx_actor_t process = SIMIX_process_from_PID(pid);
if(process != nullptr) {
- simcall_process_kill(process);
+ simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); });
} else {
std::ostringstream oss;
oss << "kill: ("<< pid <<") - No such process" << std::endl;
}
void Actor::kill() {
- simcall_process_kill(pimpl_);
+ smx_actor_t process = SIMIX_process_self();
+ simgrid::simix::kernelImmediate(
+ [this, process] { SIMIX_process_kill(pimpl_, (pimpl_ == simix_global->maestro_process) ? pimpl_ : process); });
}
// ***** Static functions *****
void kill()
{
- simcall_process_kill(SIMIX_process_self());
+ smx_actor_t process = SIMIX_process_self();
+ simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); });
}
void onExit(int_f_pvoid_pvoid_t fun, void* data)
simix_global->process_to_run.clear();
}
-void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_actor_t process) {
- SIMIX_process_kill(process, simcall->issuer);
-}
/**
* \brief Internal function to kill a SIMIX process.
*
return (e_smx_state_t) simcall_BODY_execution_wait(execution);
}
-/**
- * \ingroup simix_process_management
- * \brief Kills a SIMIX process.
- *
- * This function simply kills a process.
- *
- * \param process poor victim
- */
-void simcall_process_kill(smx_actor_t process)
-{
- simcall_BODY_process_kill(process);
-}
-
/**
* \ingroup simix_process_management
* \brief Kills all SIMIX processes.
*/
#include "src/simix/popping_private.h"
-static inline smx_actor_t simcall_process_kill__get__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
-}
-static inline smx_actor_t simcall_process_kill__getraw__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_actor_t>(simcall->args[0]);
-}
-static inline void simcall_process_kill__set__process(smx_simcall_t simcall, smx_actor_t arg)
-{
- simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
-}
-
static inline int simcall_process_killall__get__reset_pid(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<int>(simcall->args[0]);
/* The prototype of all simcall handlers, automatically generated for you */
-XBT_PRIVATE void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_actor_t process);
XBT_PRIVATE void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid);
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);
return simgrid::simix::unmarshal<R>(self->simcall.result);
}
-inline static void simcall_BODY_process_kill(smx_actor_t process) {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) simcall_HANDLER_process_kill(&SIMIX_process_self()->simcall, process);
- return simcall<void, smx_actor_t>(SIMCALL_PROCESS_KILL, process);
- }
-
inline static void simcall_BODY_process_killall(int reset_pid) {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) simcall_HANDLER_process_killall(&SIMIX_process_self()->simcall, reset_pid);
*/
typedef enum {
SIMCALL_NONE,
- SIMCALL_PROCESS_KILL,
SIMCALL_PROCESS_KILLALL,
SIMCALL_PROCESS_CLEANUP,
SIMCALL_PROCESS_SUSPEND,
/** @brief Simcalls' names (generated from src/simix/simcalls.in) */
const char* simcall_names[] = {
"SIMCALL_NONE",
- "SIMCALL_PROCESS_KILL",
"SIMCALL_PROCESS_KILLALL",
"SIMCALL_PROCESS_CLEANUP",
"SIMCALL_PROCESS_SUSPEND",
if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP)
return;
switch (simcall->call) {
-case SIMCALL_PROCESS_KILL:
- simcall_HANDLER_process_kill(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_PROCESS_KILLALL:
simcall_HANDLER_process_killall(simcall, simgrid::simix::unmarshal<int>(simcall->args[0]));
SIMIX_simcall_answer(simcall);
# 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_kill(smx_actor_t process);
void process_killall(int reset_pid);
void process_cleanup(smx_actor_t process) [[nohandler]];
void process_suspend(smx_actor_t process) [[block]];
/* Run all processes that are ready to run, possibly in parallel */
SIMIX_process_runall();
- /* Move all killer processes to the end of the list, because killing a process that have an ongoing simcall is a bad idea */
- simgrid::xbt::three_way_partition(begin(simix_global->process_that_ran), end(simix_global->process_that_ran),
- [](smx_actor_t p) {
- switch (p->simcall.call) {
- case SIMCALL_NONE:
- case SIMCALL_PROCESS_KILL:
- return 2;
- // case SIMCALL_PROCESS_RESUME:
- // return 1;
- default:
- return 0;
- }
- });
-
/* answer sequentially and in a fixed arbitrary order all the simcalls that were issued during that sub-round */
/* WARNING, the order *must* be fixed or you'll jeopardize the simulation reproducibility (see RR-7653) */
/* 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 "private.h"
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
-#include "private.h"
#include "smpi_comm.hpp"
#include "smpi_datatype_derived.hpp"
#include "smpi_process.hpp"
#include "smpi_status.hpp"
+#include "src/simix/ActorImpl.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi, "Logging specific to SMPI (pmpi)");
{
smpi_bench_end();
// FIXME: should kill all processes in comm instead
- simcall_process_kill(SIMIX_process_self());
+ smx_actor_t process = SIMIX_process_self();
+ simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); });
return MPI_SUCCESS;
}