rdv->name = name ? xbt_strdup(name) : NULL;
rdv->comm_fifo = xbt_fifo_new();
- if (name)
- xbt_dict_set(rdv_points, name, rdv, SIMIX_rdv_free);
+ if (rdv->name)
+ xbt_dict_set(rdv_points, rdv->name, rdv, SIMIX_rdv_free);
}
return rdv;
}
void SIMIX_rdv_destroy(smx_rdv_t rdv)
{
if (rdv->name)
- xbt_dict_remove(rdv_points, rdv->name);
+ xbt_dict_remove(rdv_points, rdv->name);
}
void SIMIX_rdv_free(void *data)
req->issuer->waiting_action = action;
if (MC_IS_ENABLED){
- action->state = SIMIX_DONE;
+ if(action->comm.src_proc && action->comm.dst_proc){
+ action->state = SIMIX_DONE;
+ }else{
+ /* If we reached this point, the wait request must have a timeout */
+ /* Otherwise it shouldn't be enabled and executed by the MC */
+ if(timeout == -1)
+ THROW_IMPOSSIBLE;
+
+ if(action->comm.src_proc == req->issuer)
+ action->state = SIMIX_SRC_TIMEOUT;
+ else
+ action->state = SIMIX_DST_TIMEOUT;
+ }
+
SIMIX_comm_finish(action);
return;
}
}
}
-void SIMIX_pre_comm_testany(smx_req_t req)
+void SIMIX_pre_comm_testany(smx_req_t req, unsigned int idx)
{
unsigned int cursor;
smx_action_t action;
+ xbt_dynar_t actions = req->comm_testany.comms;
req->comm_testany.result = -1;
+
+ if (MC_IS_ENABLED){
+ if((int)idx == -1){
+ SIMIX_request_answer(req);
+ }else{
+ action = xbt_dynar_get_as(actions, idx, smx_action_t);
+ xbt_fifo_push(action->request_list, req);
+ action->state = SIMIX_DONE;
+ SIMIX_comm_finish(action);
+ }
+ return;
+ }
+
xbt_dynar_foreach(req->comm_testany.comms,cursor,action) {
if (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING) {
req->comm_testany.result = cursor;
SIMIX_request_answer(req);
}
-void SIMIX_pre_comm_waitany(smx_req_t req)
+void SIMIX_pre_comm_waitany(smx_req_t req, unsigned int idx)
{
smx_action_t action;
unsigned int cursor = 0;
xbt_dynar_t actions = req->comm_waitany.comms;
+
+ if (MC_IS_ENABLED){
+ action = xbt_dynar_get_as(actions, idx, smx_action_t);
+ xbt_fifo_push(action->request_list, req);
+ req->comm_waitany.result = idx;
+ action->state = SIMIX_DONE;
+ SIMIX_comm_finish(action);
+ return;
+ }
+
xbt_dynar_foreach(actions, cursor, action){
/* Associate this request to the action */
xbt_fifo_push(action->request_list, req);
return it as the result of the call */
if (req->call == REQ_COMM_WAITANY) {
SIMIX_waitany_req_remove_from_actions(req);
- req->comm_waitany.result = xbt_dynar_search(req->comm_waitany.comms, &action);
+ if(!MC_IS_ENABLED)
+ req->comm_waitany.result = xbt_dynar_search(req->comm_waitany.comms, &action);
}
/* If the action is still in a rendez-vous point then remove from it */
SIMIX_rdv_remove(action->comm.rdv, action);
action->state = SIMIX_FAILED;
} else {
- surf_workstation_model->action_cancel(action->comm.surf_comm);
+ /* When running the MC there are no surf actions */
+ if(!MC_IS_ENABLED)
+ surf_workstation_model->action_cancel(action->comm.surf_comm);
}
}