-/* Copyright (c) 2010-2015. The SimGrid Team.
+/* Copyright (c) 2010-2020. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-static int slave(int argc, char *argv[])
+static int slave(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
{
msg_task_t task = NULL;
XBT_ATTRIB_UNUSED int res;
while (1) {
res = MSG_task_receive(&(task), mailbox);
+ if (res == MSG_HOST_FAILURE) {
+ XBT_DEBUG("The host has been turned off, this was expected");
+ return 1;
+ }
xbt_assert(res == MSG_OK, "MSG_task_get failed");
if (!strcmp(MSG_task_get_name(task), "finalize")) {
return 0;
}
-static int master(int argc, char *argv[])
+static int master(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
{
double task_comp_size = 5E7;
double task_comm_size = 1E6;
msg_host_t jupiter = MSG_host_by_name("Jupiter");
msg_task_t task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL);
- XBT_INFO("Sending \"%s\"", task->name);
+ XBT_INFO("Sending \"%s\"", MSG_task_get_name(task));
if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
MSG_task_destroy(task);
MSG_host_off(jupiter);
task = MSG_task_create("task off", task_comp_size, task_comm_size, NULL);
- XBT_INFO("Sending \"%s\"", task->name);
+ XBT_INFO("Sending \"%s\"", MSG_task_get_name(task));
if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
MSG_task_destroy(task);
xbt_dynar_free(&jupi_processes);
task = MSG_task_create("task on without proc", task_comp_size, task_comm_size, NULL);
- XBT_INFO("Sending \"%s\"", task->name);
+ XBT_INFO("Sending \"%s\"", MSG_task_get_name(task));
if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
MSG_task_destroy(task);
MSG_process_create_with_arguments("slave", slave, NULL, MSG_host_by_name("Jupiter"), 1, argvF);
task = MSG_task_create("task on with proc", task_comp_size, task_comm_size, NULL);
- XBT_INFO("Sending \"%s\"", task->name);
+ XBT_INFO("Sending \"%s\"", MSG_task_get_name(task));
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);
+ XBT_INFO("Sending \"%s\"", MSG_task_get_name(task));
if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
MSG_task_destroy(task);