X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a4ba3ac3908eb9bf0f321f354e3f331491f79539..3922ecf35babad02cc4ad9d5ad3a7fcb4e7eeabd:/teshsuite/msg/host_on_off/host_on_off.c diff --git a/teshsuite/msg/host_on_off/host_on_off.c b/teshsuite/msg/host_on_off/host_on_off.c index fe7a4fd977..f714d3f12a 100644 --- a/teshsuite/msg/host_on_off/host_on_off.c +++ b/teshsuite/msg/host_on_off/host_on_off.c @@ -13,9 +13,7 @@ static int slave(int argc, char *argv[]) msg_task_t task = NULL; XBT_ATTRIB_UNUSED int res; int id = -1; - char mailbox[80]; - - sprintf(mailbox, "jupi"); + const char * mailbox = "jupi"; while (1) { res = MSG_task_receive(&(task), mailbox); @@ -41,12 +39,10 @@ static int master(int argc, char *argv[]) double task_comp_size = 5E7; double task_comm_size = 1E6; - char mailbox[256]; - msg_task_t task = NULL; + const char * mailbox = "jupi"; msg_host_t jupiter = MSG_host_by_name("Jupiter"); - sprintf(mailbox, "jupi"); - task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL); + msg_task_t task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL); XBT_INFO("Sending \"%s\"", task->name); if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK) MSG_task_destroy(task); @@ -60,11 +56,15 @@ static int master(int argc, char *argv[]) MSG_task_destroy(task); MSG_host_on(jupiter); - xbt_swag_t jupi_processes = MSG_host_get_process_list(jupiter); - void *process; - xbt_swag_foreach(process, jupi_processes) { + + xbt_dynar_t jupi_processes = xbt_dynar_new(sizeof(msg_process_t), NULL); + MSG_host_get_process_list(jupiter, jupi_processes); + msg_process_t process = NULL; + unsigned int cursor; + xbt_dynar_foreach (jupi_processes, cursor, process) { MSG_process_kill(process); } + 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);