Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correctly destroy tasks.
[simgrid.git] / teshsuite / msg / task_destroy_cancel.c
index c71f9cb..6dda8b5 100644 (file)
@@ -38,6 +38,7 @@ int master(int argc, char *argv[])
   task = MSG_task_create("cancel directly", task_comp_size, task_comm_size, NULL);
   XBT_INFO("Canceling task \"%s\" directly", task->name);
   MSG_task_cancel(task);
+  MSG_task_destroy(task);
 
   task = MSG_task_create("destroy directly", task_comp_size, task_comm_size, NULL);
   XBT_INFO("Destroying task \"%s\" directly", task->name);
@@ -54,6 +55,7 @@ int master(int argc, char *argv[])
     xbt_ex_free(ex);
     MSG_comm_destroy(comm);
   }
+  MSG_task_destroy(task);
 
   task = MSG_task_create("finalize", task_comp_size, task_comm_size, NULL);
   comm = MSG_task_isend(task, mailbox);
@@ -80,9 +82,11 @@ int master(int argc, char *argv[])
 static int worker_main(int argc, char *argv[])
 {
   msg_task_t task = MSG_process_get_data(MSG_process_self());
+  msg_error_t res;
   XBT_INFO("Start %s", task->name);
-  MSG_task_execute(task);
-  XBT_INFO("Task done");
+  res = MSG_task_execute(task);
+  XBT_INFO("Task %s", res == MSG_OK ? "done" : "failed");
+  MSG_task_destroy(task);
   return 0;
 }