Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge before commiting VM changes - Adrien
[simgrid.git] / teshsuite / msg / host_on_off / host_on_off.c
index 3b42831..530fdd0 100644 (file)
@@ -5,7 +5,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdio.h>
-#include "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "simgrid/msg.h"            /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
 #include "xbt/sysdep.h"         /* calloc, printf */
 
 /* Create a log channel to have nice outputs. */
@@ -25,7 +25,7 @@ int master(int argc, char *argv[])
 
   char mailbox[256];
   msg_task_t task = NULL;
-
+  msg_host_t jupiter = MSG_get_host_by_name("Jupiter");
   sprintf(mailbox, "jupi");
 
   task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL);
@@ -34,14 +34,19 @@ int master(int argc, char *argv[])
     MSG_task_destroy(task);
 
   MSG_process_sleep(1);
-  MSG_host_off(MSG_get_host_by_name("Jupiter"));
+  MSG_host_off(jupiter);
 
   task = MSG_task_create("task off", task_comp_size, task_comm_size, NULL);
   XBT_INFO("Sending \"%s\"", task->name);
   if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
     MSG_task_destroy(task);
 
-  MSG_host_on(MSG_get_host_by_name("Jupiter"));
+  MSG_host_on(jupiter);
+  xbt_swag_t jupi_processes = MSG_host_get_process_list(jupiter);
+  void *process;
+  xbt_swag_foreach(process, jupi_processes) {
+    MSG_process_kill(process);
+  }
 
   task = MSG_task_create("task on without proc", task_comp_size, task_comm_size, NULL);
   XBT_INFO("Sending \"%s\"", task->name);