Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Split another xml file (memory leaks in the parser).
[simgrid.git] / teshsuite / msg / host_on_off.c
index a26d7e0..3b42831 100644 (file)
@@ -30,20 +30,23 @@ int master(int argc, char *argv[])
 
   task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL);
   XBT_INFO("Sending \"%s\"", task->name);
-  MSG_task_send_with_timeout(task, mailbox, 1);
+  if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
+    MSG_task_destroy(task);
 
   MSG_process_sleep(1);
   MSG_host_off(MSG_get_host_by_name("Jupiter"));
 
   task = MSG_task_create("task off", task_comp_size, task_comm_size, NULL);
   XBT_INFO("Sending \"%s\"", task->name);
-  MSG_task_send_with_timeout(task, mailbox, 1);
+  if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
+    MSG_task_destroy(task);
 
   MSG_host_on(MSG_get_host_by_name("Jupiter"));
 
   task = MSG_task_create("task on without proc", task_comp_size, task_comm_size, NULL);
   XBT_INFO("Sending \"%s\"", task->name);
-  MSG_task_send_with_timeout(task, mailbox, 1);
+  if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
+    MSG_task_destroy(task);
 
   char **argvF = xbt_new(char*, 2);
   argvF[0] = xbt_strdup("slave");
@@ -51,11 +54,13 @@ int master(int argc, char *argv[])
 
   task = MSG_task_create("task on with proc", task_comp_size, task_comm_size, NULL);
   XBT_INFO("Sending \"%s\"", task->name);
-  MSG_task_send_with_timeout(task, mailbox, 1);
+  if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
+    MSG_task_destroy(task);
 
   task = MSG_task_create("finalize", 0, 0, 0);
   XBT_INFO("Sending \"%s\"", task->name);
-  MSG_task_send_with_timeout(task, mailbox, 1);
+  if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
+    MSG_task_destroy(task);
 
   XBT_INFO("Goodbye now!");
   return 0;
@@ -68,7 +73,6 @@ int slave(int argc, char *argv[])
   _XBT_GNUC_UNUSED int res;
   int id = -1;
   char mailbox[80];
-  _XBT_GNUC_UNUSED int read;
 
   sprintf(mailbox, "jupi");
 
@@ -99,13 +103,13 @@ int main(int argc, char *argv[])
   const char *application_file;
 
   MSG_init(&argc, argv);
-  if (argc < 2) {
+  if (argc != 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
     exit(1);
   }
   platform_file = argv[1];
-  application_file = argv[1];
+  application_file = argv[2];
 
   /* MSG_config("workstation/model","KCCFLN05"); */
   {                             /*  Simulation setting */