X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/80f4ee5ded92a8c021ef342cf6759242ab9479c4..aafaaf396698612d5174bb0780c0a548e5422d84:/examples/msg/cloud/masterslave_virtual_machines.c diff --git a/examples/msg/cloud/masterslave_virtual_machines.c b/examples/msg/cloud/masterslave_virtual_machines.c index 8edf3b7f53..e1527eb61e 100644 --- a/examples/msg/cloud/masterslave_virtual_machines.c +++ b/examples/msg/cloud/masterslave_virtual_machines.c @@ -134,6 +134,9 @@ int master(int argc, char *argv[]) { MSG_task_send(finalize, mailbox_buffer); } + XBT_INFO("Wait a while before effective shutdown."); + MSG_process_sleep(2); + xbt_dynar_foreach(vms,i,vm) { MSG_vm_shutdown(vm); MSG_vm_destroy(vm); @@ -148,12 +151,12 @@ int master(int argc, char *argv[]) { /** Receiver function */ int slave_fun(int argc, char *argv[]) { - char *mailbox_name; + char mailbox_name[128]; msg_task_t task = NULL; _XBT_GNUC_UNUSED int res; /* since the slaves will move around, use slave_%d as mailbox names instead of hostnames */ xbt_assert(argc>=2, "slave processes need to be given their rank as parameter"); - mailbox_name=bprintf("Slave_%s",argv[1]); + sprintf(mailbox_name,"Slave_%s",argv[1]); XBT_INFO("Slave listenning on %s",argv[1]); while (1) { res = MSG_task_receive(&(task),mailbox_name); @@ -171,7 +174,6 @@ int slave_fun(int argc, char *argv[]) task = NULL; } - free(mailbox_name); return 0; } /* end_of_slave */ @@ -216,8 +218,9 @@ int main(int argc, char *argv[]) res = MSG_main(); XBT_INFO("Simulation time %g", MSG_get_clock()); - MSG_clean(); free(hosts); + for (i=0;i<10;i++) + free(hostnames[i]); free(hostnames); xbt_dynar_free(&hosts_dynar);