#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");
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");
+ 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");
}
} 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;
}
}
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");
MSG_function_register("consumer", consumer);
MSG_function_register("producer", producer);
MSG_launch_application("deploy_bugged2_liveness.xml");
- MSG_main_liveness(automaton);
+ MSG_main_liveness(a);
return 0;