Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Cross-process access to smx_process and simcall
[simgrid.git] / src / mc / mc_model_checker.h
index 308cf12..9c6b876 100644 (file)
 #include <sys/types.h>
 
 #include <simgrid_config.h>
+#include <xbt/dynar.h>
 
 #include "mc_forward.h"
 #include "mc_process.h"
 #include "mc_page_store.h"
+#include "mc_protocol.h"
 
 SG_BEGIN_DECL()
 
@@ -37,6 +39,21 @@ struct s_mc_model_checker {
 mc_model_checker_t MC_model_checker_new(pid_t pid, int socket);
 void MC_model_checker_delete(mc_model_checker_t mc);
 
+#define MC_EACH_SIMIX_PROCESS(process, code) \
+  if (MC_process_is_self(&mc_model_checker->process)) { \
+    xbt_swag_foreach(process, simix_global->process_list) { \
+      code; \
+    } \
+  } else { \
+    MC_process_refresh_simix_processes(&mc_model_checker->process); \
+    unsigned int _smx_process_index; \
+    mc_smx_process_info_t _smx_process_info; \
+    xbt_dynar_foreach_ptr(mc_model_checker->process.smx_process_infos, _smx_process_index, _smx_process_info) { \
+      smx_process_t process = &_smx_process_info->copy; \
+      code; \
+    } \
+  }
+
 SG_END_DECL()
 
 #endif