X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/00b3a9e9f8a8cc61947afadbfb2db026b4b7f56d..cce9bf321c240cca55882e769e8871e814c5af07:/teshsuite/msg/task_destroy_cancel.c diff --git a/teshsuite/msg/task_destroy_cancel.c b/teshsuite/msg/task_destroy_cancel.c index e0cfa53fe6..6dda8b5a96 100644 --- a/teshsuite/msg/task_destroy_cancel.c +++ b/teshsuite/msg/task_destroy_cancel.c @@ -27,6 +27,8 @@ int master(int argc, char *argv[]) char mailbox[256]; msg_task_t task = NULL; msg_comm_t comm = NULL; + xbt_ex_t ex; + sprintf(mailbox, "jupi"); task = MSG_task_create("normal", task_comp_size, task_comm_size, NULL); @@ -36,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); @@ -45,11 +48,26 @@ int master(int argc, char *argv[]) comm = MSG_task_isend(task, mailbox); XBT_INFO("Canceling task \"%s\" during comm", task->name); MSG_task_cancel(task); + TRY { + MSG_comm_wait(comm, -1); + } + CATCH (ex) { + 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); XBT_INFO("Destroying task \"%s\" during comm", task->name); MSG_task_destroy(task); + TRY { + MSG_comm_wait(comm, -1); + } + CATCH (ex) { + xbt_ex_free(ex); + MSG_comm_destroy(comm); + } task = MSG_task_create("cancel", task_comp_size, task_comm_size, NULL); MSG_task_send_with_timeout(task, mailbox, timeout); @@ -64,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; } @@ -77,7 +97,7 @@ int slave(int argc, char *argv[]) _XBT_GNUC_UNUSED int res; int id = -1; char mailbox[80]; - double duration, start, end; + double start, end; sprintf(mailbox, "jupi"); while (1) { @@ -99,7 +119,6 @@ int slave(int argc, char *argv[]) continue; } - duration = MSG_task_get_compute_duration(task); start = MSG_get_clock(); MSG_task_execute(task); end = MSG_get_clock();