+void SIMIX_process_on_exit_runall(smx_process_t process) {
+ s_smx_process_exit_fun_t exit_fun;
+
+ while (!xbt_dynar_is_empty(process->on_exit)) {
+ exit_fun = xbt_dynar_pop_as(process->on_exit,s_smx_process_exit_fun_t);
+ (exit_fun.fun)(exit_fun.arg);
+ }
+}
+void SIMIX_process_on_exit(smx_process_t process, int_f_pvoid_t fun, void *data) {
+ xbt_assert(process, "current process not found: are you in maestro context ?");
+
+ if (!process->on_exit) {
+ process->on_exit = xbt_dynar_new(sizeof(s_smx_process_exit_fun_t), NULL);
+ }
+
+ s_smx_process_exit_fun_t exit_fun = {fun, data};
+
+ xbt_dynar_push_as(process->on_exit,s_smx_process_exit_fun_t,exit_fun);
+}
+/**
+ * \brief Sets the auto-restart status of the process.
+ * If set to 1, the process will be automatically restarted when its host
+ * comes back.
+ */
+void SIMIX_process_auto_restart_set(smx_process_t process, int auto_restart) {
+ process->auto_restart = auto_restart;
+}