From: Arnaud Giersch Date: Thu, 6 Mar 2014 11:56:54 +0000 (+0100) Subject: Destroy tasks if sending has failed. X-Git-Tag: v3_11~242^2~12 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/0b6f5de841baa5e0982e56a40cfd67f342517c1d Destroy tasks if sending has failed. --- diff --git a/teshsuite/msg/host_on_off.c b/teshsuite/msg/host_on_off.c index cc542af7fa..3b42831c95 100644 --- a/teshsuite/msg/host_on_off.c +++ b/teshsuite/msg/host_on_off.c @@ -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;