/* 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 <xbt/ex.hpp>
#include <stdio.h> /* sscanf */
msg_task_t task = MSG_task_create("daemon", MSG_host_get_speed(MSG_host_self()), 0, NULL);
MSG_process_set_data(self, task);
XBT_INFO(" Execute daemon");
- MSG_task_execute(task);
- MSG_process_set_data(self, NULL);
+ msg_error_t res = MSG_task_execute(task);
MSG_task_destroy(task);
tasks_done++;
+ if (res == MSG_HOST_FAILURE) {
+ XBT_INFO("Host as died as expected, do nothing else");
+ return 0;
+ }
}
XBT_INFO(" daemon done. See you!");
return 0;
// 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;
- }
+ } catch (simgrid::HostFailureException& e) {
+ XBT_INFO("The host has died ... as expected.");
}
XBT_INFO(" TX done");
return 0;
MSG_create_environment(argv[1]);
- MSG_process_set_data_cleanup(task_cleanup_handler);
MSG_process_create("test_launcher", test_launcher, NULL, MSG_get_host_by_name("Tremblay"));
res = MSG_main();