Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
The file containing the new implementation of the switch context mechanism.
[simgrid.git] / src / msg / global.c
index 602ddc4..3436087 100644 (file)
@@ -43,7 +43,7 @@ void MSG_global_init_args(int *argc, char **argv)
  */
 void MSG_global_init(int *argc, char **argv)
 {
-  xbt_getpid = &MSG_process_self_PID;
+  xbt_getpid = MSG_process_self_PID;
   if (!msg_global) {
     SIMIX_global_init(argc, argv);
 
@@ -53,6 +53,10 @@ void MSG_global_init(int *argc, char **argv)
     msg_global->process_list = xbt_fifo_new();
     msg_global->max_channel = 0;
     msg_global->PID = 1;
+
+    SIMIX_function_register_process_create(_MSG_process_create_from_SIMIX);
+    SIMIX_function_register_process_cleanup(__MSG_process_cleanup);
+    SIMIX_function_register_process_kill(_MSG_process_kill_from_SIMIX);
   }
   return;
 }
@@ -227,6 +231,7 @@ MSG_error_t MSG_clean(void)
   xbt_fifo_free(msg_global->process_list);
 
   free(msg_global);
+  msg_global = NULL;
   SIMIX_clean();
 
   return MSG_OK;