From 9bfc53cc59cae28067100a5c8b377d64f6b95a8d Mon Sep 17 00:00:00 2001 From: mquinson Date: Thu, 23 Nov 2006 10:39:16 +0000 Subject: [PATCH] Fix the code to kill surnumerous slaves git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2939 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- examples/gras/pmm/pmm.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/examples/gras/pmm/pmm.c b/examples/gras/pmm/pmm.c index 8fba48d1ae..101ab30c06 100755 --- a/examples/gras/pmm/pmm.c +++ b/examples/gras/pmm/pmm.c @@ -80,6 +80,7 @@ typedef struct { int master (int argc,char *argv[]) { int i; + double init_delay; xbt_matrix_t A,B,C; result_t result; @@ -104,8 +105,15 @@ int master (int argc,char *argv[]) { xbt_assert0(argc>1, "Usage: master "); gras_socket_server(atoi(argv[1])); peers=amok_pm_group_new("pmm"); - INFO0("Wait for peers for 7 sec"); - gras_msg_handleall(7); /* friends, we're ready. Come and play */ + + /* friends, we're ready. Come and play */ + if (gras_if_RL()) { + init_delay = 5; + } else { + init_delay = 15; /* no idea why I have to wait that long in simulation */ + } + INFO1("Wait for peers for %.0f sec",init_delay); + gras_msg_handleall(init_delay); INFO1("Got %ld pals",xbt_dynar_length(peers)); for (i=0; @@ -125,8 +133,8 @@ int master (int argc,char *argv[]) { for (i=SLAVE_COUNT; iname, h->port); + xbt_dynar_remove_at(peers,i,&h); + INFO2("Too much slaves. Killing %s:%d", h->name, h->port); amok_pm_kill_hp(h->name,h->port); free(h); } -- 2.20.1