X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d43e84e981024537b56f15f7dcc937b0202cad2b..0af2746ea094442ef04e3f0fab84710cdd43b50b:/teshsuite/msg/host_on_off_processes/host_on_off_processes.cpp diff --git a/teshsuite/msg/host_on_off_processes/host_on_off_processes.cpp b/teshsuite/msg/host_on_off_processes/host_on_off_processes.cpp index 8f0b5b2d36..669bd11a6a 100644 --- a/teshsuite/msg/host_on_off_processes/host_on_off_processes.cpp +++ b/teshsuite/msg/host_on_off_processes/host_on_off_processes.cpp @@ -3,8 +3,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "simgrid/Exception.hpp" #include "simgrid/msg.h" -#include #include /* sscanf */ @@ -43,7 +43,11 @@ static int process_sleep(int /*argc*/, char** /*argv*/) { for (;;) { XBT_INFO(" I'm alive but I should sleep"); - MSG_process_sleep(10); + int res = MSG_process_sleep(10); + if (res == MSG_HOST_FAILURE) { + XBT_INFO("Host as died as expected, do nothing else"); + return 0; + } } XBT_INFO(" I'm done. See you!"); return 0; @@ -56,15 +60,9 @@ static int commTX(int /*argc*/, char** /*argv*/) msg_task_t task = MSG_task_create("COMM", 0, 100000000, NULL); MSG_task_dsend(task, mailbox, task_cleanup_handler); // We should wait a bit (if not the process will end before the communication, hence an exception on the other side). - try { - MSG_process_sleep(30); - } catch (xbt_ex& e) { - if (e.category == host_error) { - XBT_INFO("The host has died ... as expected."); - } else { - XBT_ERROR("An unexpected exception has been raised."); - throw; - } + int res = MSG_process_sleep(30); + if (res == MSG_HOST_FAILURE) { + XBT_INFO("The host has died ... as expected."); } XBT_INFO(" TX done"); return 0;