X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2b1e59493dcd4f1709b1228c673364ef7facc6e5..830b5c4bc694ade087c43f39015faa9065795630:/examples/msg/mc/bugged2_liveness.c diff --git a/examples/msg/mc/bugged2_liveness.c b/examples/msg/mc/bugged2_liveness.c index 25a35ca482..03d9d6c709 100644 --- a/examples/msg/mc/bugged2_liveness.c +++ b/examples/msg/mc/bugged2_liveness.c @@ -40,29 +40,29 @@ int coordinator(int argc, char *argv[]) int CS_used = 0; while(1) { - m_task_t task = NULL; + msg_task_t task = NULL; MSG_task_receive(&task, "coordinator"); const char *kind = MSG_task_get_name(task); if (!strcmp(kind, "request")) { char *req = MSG_task_get_data(task); if (CS_used) { - XBT_INFO("CS already used. Queue the request"); - xbt_dynar_push(requests, &req); + XBT_INFO("CS already used. Queue the request"); + xbt_dynar_push(requests, &req); } else { - m_task_t answer = MSG_task_create("grant", 0, 1000, NULL); - MSG_task_send(answer, req); - CS_used = 1; - XBT_INFO("CS idle. Grant immediatly"); + msg_task_t answer = MSG_task_create("grant", 0, 1000, NULL); + MSG_task_send(answer, req); + CS_used = 1; + XBT_INFO("CS idle. Grant immediatly"); } } else { if (xbt_dynar_length(requests) > 0) { - XBT_INFO("CS release. Grant to queued requests"); - char *req; - xbt_dynar_pop(requests, &req); - MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req); + XBT_INFO("CS release. Grant to queued requests"); + char *req; + xbt_dynar_pop(requests, &req); + MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req); } else { - XBT_INFO("CS_realase, ressource now idle"); - CS_used = 0; + XBT_INFO("CS_realase, ressource now idle"); + CS_used = 0; } } @@ -92,7 +92,7 @@ int producer(int argc, char *argv[]) MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), "coordinator"); /* Wait the answer */ - m_task_t grant = NULL; + msg_task_t grant = NULL; MSG_task_receive(&grant, my_mailbox); MSG_task_destroy(grant); @@ -133,7 +133,7 @@ int consumer(int argc, char *argv[]) XBT_INFO("cready = 1"); /* Wait the answer */ - m_task_t grant = NULL; + msg_task_t grant = NULL; MSG_task_receive(&grant, my_mailbox); MSG_task_destroy(grant); @@ -172,19 +172,20 @@ int main(int argc, char *argv[]) buffer = malloc(8*sizeof(char)); buffer[0]='\0'; - 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_init(&argc, argv); + + MSG_config("model-check/property","promela2_bugged2_liveness"); + MC_automaton_new_propositional_symbol("pready", &predPready); + MC_automaton_new_propositional_symbol("cready", &predCready); + MC_automaton_new_propositional_symbol("consume", &predConsume); + MC_automaton_new_propositional_symbol("produce", &predProduce); + MSG_create_environment("../msg_platform.xml"); MSG_function_register("coordinator", coordinator); MSG_function_register("consumer", consumer); MSG_function_register("producer", producer); MSG_launch_application("deploy_bugged2_liveness.xml"); - MSG_main_liveness(a); + MSG_main(); return 0;