- 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));
+ simgrid::kernel::actor::ProcessArg* arg =
+ new simgrid::kernel::actor::ProcessArg(name, code, data, host, kill_time, nullptr, auto_restart);
+ arg->properties.reset(properties, [](decltype(properties)) {});
+
+ if (host->isOff() && watched_hosts.find(host->get_cname()) == watched_hosts.end()) {
+ watched_hosts.insert(host->get_cname());
+ XBT_DEBUG("Push host %s to watched_hosts because state == SURF_RESOURCE_OFF", host->get_cname());