int CS_used = 0;
msg_task_t task = NULL, answer = NULL;
- while (1) {
+ while(1){
MSG_task_receive(&task, "coordinator");
const char *kind = MSG_task_get_name(task);
if (!strcmp(kind, "request")) {
if (CS_used) {
XBT_INFO("CS already used.");
} else {
- if(strcmp(req, "2") == 0){
+ if(strcmp(req, "1") != 0){
XBT_INFO("CS idle. Grant immediatly");
answer = MSG_task_create("grant", 0, 1000, NULL);
MSG_task_send(answer, req);
}
MSG_task_destroy(task);
task = NULL;
+ kind = NULL;
}
return 0;
{
int my_pid = MSG_process_get_PID(MSG_process_self());
- char *my_mailbox = bprintf("%s", argv[1]);
+ char *my_mailbox = xbt_strdup(argv[1]);
msg_task_t grant = NULL, release = NULL;
-
-
- while(1) {
-
+
+ while(1){
XBT_INFO("Ask the request");
MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), "coordinator");
MSG_task_destroy(grant);
grant = NULL;
+ kind = NULL;
XBT_INFO("%s got the answer. Sleep a bit and release it", argv[1]);
MSG_init(&argc, argv);
- MSG_config("model-check/property","promela1_bugged1_liveness");
+ MSG_config("model-check/property","promela_bugged1_liveness");
MC_automaton_new_propositional_symbol("r", &predR);
MC_automaton_new_propositional_symbol("cs", &predCS);