X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/217b4afb954d1795f011f060767b8d89533f2b71..409f7a8342cc507a9117bfda8b782bf862670005:/examples/msg/mc/bugged2_liveness.c diff --git a/examples/msg/mc/bugged2_liveness.c b/examples/msg/mc/bugged2_liveness.c index 47fa7e616d..09ec963ce4 100644 --- a/examples/msg/mc/bugged2_liveness.c +++ b/examples/msg/mc/bugged2_liveness.c @@ -7,9 +7,7 @@ #include "msg/msg.h" #include "mc/mc.h" #include "xbt/automaton.h" -#include "xbt/automatonparse_promela.h" #include "bugged2_liveness.h" -#include "y.tab.c" XBT_LOG_NEW_DEFAULT_CATEGORY(bugged2_liveness, "my log messages"); @@ -87,6 +85,7 @@ int producer(int argc, char *argv[]) const char *mess = "message"; pready = 1; + XBT_INFO("pready = 1"); /* CS request */ XBT_INFO("Producer ask the request"); @@ -101,6 +100,7 @@ int producer(int argc, char *argv[]) buffer = strdup(mess); produce = 1; + XBT_INFO("produce = 1"); /* CS release */ MSG_task_send(MSG_task_create("release", 0, 1000, my_mailbox), "coordinator"); @@ -108,6 +108,8 @@ int producer(int argc, char *argv[]) produce = 0; pready = 0; + XBT_INFO("pready et produce = 0"); + } return 0; @@ -128,6 +130,7 @@ int consumer(int argc, char *argv[]) MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), "coordinator"); cready = 1; + XBT_INFO("cready = 1"); /* Wait the answer */ m_task_t grant = NULL; @@ -139,10 +142,12 @@ int consumer(int argc, char *argv[]) mess = strdup(buffer); buffer[0] = '\0'; - /* Display message */ + /* Display message */ XBT_INFO("Message : %s", mess); - if(strcmp(mess, "") != 0) + if(strcmp(mess, "") != 0){ consume = 1; + XBT_INFO("consume = 1"); + } /* CS release */ MSG_task_send(MSG_task_create("release", 0, 1000, my_mailbox), "coordinator"); @@ -152,6 +157,8 @@ int consumer(int argc, char *argv[]) consume = 0; cready = 0; + XBT_INFO("cready et consume = 0"); + } return 0; @@ -165,13 +172,11 @@ int main(int argc, char *argv[]) buffer = malloc(8*sizeof(char)); buffer[0]='\0'; - init(); - yyparse(); - automaton = get_automaton(); - xbt_new_propositional_symbol(automaton,"pready", &predPready); - xbt_new_propositional_symbol(automaton,"cready", &predCready); - xbt_new_propositional_symbol(automaton,"consume", &predConsume); - xbt_new_propositional_symbol(automaton,"produce", &predProduce); + xbt_automaton_t a = MC_create_automaton("promela2_bugged2_liveness"); + xbt_new_propositional_symbol(a,"pready", &predPready); + xbt_new_propositional_symbol(a,"cready", &predCready); + xbt_new_propositional_symbol(a,"consume", &predConsume); + xbt_new_propositional_symbol(a,"produce", &predProduce); MSG_global_init(&argc, argv); MSG_create_environment("../msg_platform.xml"); @@ -179,7 +184,7 @@ int main(int argc, char *argv[]) MSG_function_register("consumer", consumer); MSG_function_register("producer", producer); MSG_launch_application("deploy_bugged2_liveness.xml"); - MSG_main_liveness(automaton, argv[0]); + MSG_main_liveness(a); return 0;