/* Process creation/destruction callbacks */
typedef void (*void_pfn_smxprocess_t) (smx_process_t);
+/* for function autorestart */
+typedef void (*void_pfn_smxhost_t) (smx_host_t);
/* The following function pointer types describe the interface that any context
factory should implement */
simix_global->action_mallocator = xbt_mallocator_new(65536,
SIMIX_action_mallocator_new_f, SIMIX_action_mallocator_free_f,
SIMIX_action_mallocator_reset_f);
+ simix_global->autorestart = SIMIX_host_restart_processes;
surf_init(argc, argv); /* Initialize SURF structures */
SIMIX_context_mod_init();
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_host, simix,
"Logging specific to SIMIX (hosts)");
-xbt_dict_t watched_hosts_lib;
-
static void SIMIX_execution_finish(smx_action_t action);
/**
xbt_dynar_reset(host->auto_restart_processes);
}
+void SIMIX_host_autorestart(smx_host_t host)
+{
+ if(simix_global->autorestart)
+ simix_global->autorestart(host);
+ else
+ xbt_die("No function for simix_global->autorestart");
+}
+
void SIMIX_host_set_data(smx_host_t host, void *data)
{
xbt_assert((host != NULL), "Invalid parameters");
xbt_dict_t properties,
int auto_restart);
void SIMIX_host_restart_processes(smx_host_t host);
+void SIMIX_host_autorestart(smx_host_t host);
xbt_dict_t SIMIX_host_get_properties(smx_host_t host);
double SIMIX_host_get_speed(smx_host_t host);
double SIMIX_host_get_available_speed(smx_host_t host);
void_pfn_smxprocess_t kill_process_function;
void_pfn_smxprocess_t cleanup_process_function;
xbt_mallocator_t action_mallocator;
+ void_pfn_smxhost_t autorestart;
} s_smx_global_t, *smx_global_t;
extern smx_global_t simix_global;
extern unsigned long simix_process_maxpid;
+extern xbt_dict_t watched_hosts_lib;
+
/******************************** Exceptions *********************************/
#define SMX_EXCEPTION(issuer, c, v, m) \
xbt_dict_foreach(watched_hosts_lib,cursor,key,host)
{
if(SIMIX_host_get_state(host) == SURF_RESOURCE_ON){
- XBT_DEBUG("See SURF_RESOURCE_ON on host: %s",SIMIX_host_get_name(host));
- // TODO need to restart all processes on host->auto_restart_processes
- XBT_INFO("Should call SIMIX restart host here for '%s'",SIMIX_host_get_name(host));
- // TODO be sure having remove the wake up host
- //xbt_dict_remove(watched_hosts_lib,key);
+ XBT_INFO("Restart processes on host: %s",SIMIX_host_get_name(host));
+ SIMIX_host_autorestart(host);
+ xbt_dict_remove(watched_hosts_lib,key);
}
else
XBT_DEBUG("See SURF_RESOURCE_OFF on host: %s",key);
extern int sg_gtnets_jitter_seed;
#endif
-extern xbt_dict_t watched_hosts_lib;
+xbt_dict_t watched_hosts_lib;
extern const char *surf_action_state_names[6];