- char *req ;
- xbt_dynar_get_cpy(requests, (xbt_dynar_length(requests) - 1), &req);
- if(strcmp(req, "1") == 0){
- xbt_dynar_pop(requests, &req);
- MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req);
- todo--;
- }else{
- xbt_dynar_pop(requests, &req);
- MSG_task_send(MSG_task_create("notgrant", 0, 1000, NULL), req);
- CS_used = 0;
- todo--;
- }
- } else { // nobody wants it
+ xbt_dynar_shift(requests, &req);
+ if(strcmp(req, "1") != 0){
+ MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req);
+ }else{
+ xbt_dynar_push(requests, &req);
+ CS_used = 0;
+ }
+ }else{