- smx_process_arg_t arg = *(static_cast<smx_process_arg_t*>(data));
- delete arg;
-}
-/**
- * \brief Add a process to the list of the processes that the host will restart when it comes back
- * This function add a process to the list of the processes that will be restarted when the host comes
- * back. It is expected that this function is called when the host is down.
- * The processes will only be restarted once, meaning that you will have to register the process
- * again to restart the process again.
- */
-void SIMIX_host_add_auto_restart_process(
- sg_host_t host, const char *name, std::function<void()> code,
- void* data, const char *hostname, double kill_time,
- xbt_dict_t properties, int auto_restart)
-{
- if (!sg_host_simix(host)->auto_restart_processes) {
- sg_host_simix(host)->auto_restart_processes = xbt_dynar_new(sizeof(smx_process_arg_t),_SIMIX_host_free_process_arg);
- }
- smx_process_arg_t arg = new simgrid::simix::ProcessArg();
- arg->name = name;
- arg->code = std::move(code);
- arg->data = data;
- arg->hostname = hostname;
- arg->kill_time = kill_time;
- arg->properties = properties;
- arg->auto_restart = auto_restart;
-
- if( host->isOff() && !xbt_dict_get_or_null(watched_hosts_lib,sg_host_get_name(host))){
- xbt_dict_set(watched_hosts_lib,sg_host_get_name(host),host,nullptr);
- XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",sg_host_get_name(host));
- }
- xbt_dynar_push_as(sg_host_simix(host)->auto_restart_processes,smx_process_arg_t,arg);
-}
-/** @brief Restart the list of processes that have been registered to the host */
-void SIMIX_host_autorestart(sg_host_t host)
-{
- unsigned int cpt;
- smx_process_arg_t arg;
- xbt_dynar_t process_list = sg_host_simix(host)->auto_restart_processes;
- if (!process_list)
- return;
-
- xbt_dynar_foreach (process_list, cpt, arg) {
-
- XBT_DEBUG("Restarting Process %s(%s) right now", arg->name.c_str(), arg->hostname);
- if (simix_global->create_process_function) {
- simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->hostname, arg->kill_time,
- arg->properties, arg->auto_restart, nullptr);
- } else {
- simcall_process_create(arg->name.c_str(), arg->code, nullptr, arg->hostname, arg->kill_time, arg->properties,
- arg->auto_restart);
- }
- }
- xbt_dynar_reset(process_list);
-}
-
-smx_activity_t simcall_HANDLER_execution_start(smx_simcall_t simcall, const char* name, double flops_amount,
- double priority, double bound) {
- return SIMIX_execution_start(simcall->issuer, name,flops_amount,priority,bound);
-}
-
-smx_activity_t SIMIX_execution_start(smx_actor_t issuer, const char *name, double flops_amount, double priority,
- double bound){
-
- /* alloc structures and initialize */
- simgrid::kernel::activity::Exec *exec = new simgrid::kernel::activity::Exec(name, issuer->host);
-