"Logging specific to SIMIX (network)");
static xbt_dict_t rdv_points = NULL;
-unsigned long int smx_total_comms = 0;
+XBT_PUBLIC(unsigned long int) smx_total_comms = 0;
static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall);
static void SIMIX_comm_copy_data(smx_action_t comm);
static smx_action_t SIMIX_comm_new(e_smx_comm_type_t type);
static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm);
+static smx_action_t SIMIX_fifo_probe_comm(xbt_fifo_t fifo, e_smx_comm_type_t type,
+ int (*match_fun)(void *, void *,smx_action_t),
+ void *user_data, smx_action_t my_action);
static smx_action_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type,
int (*match_fun)(void *, void *,smx_action_t),
void *user_data, smx_action_t my_action);
void SIMIX_network_init(void)
{
rdv_points = xbt_dict_new_homogeneous(SIMIX_rdv_free);
+ if(MC_is_active())
+ MC_ignore(&smx_total_comms, sizeof(smx_total_comms));
}
void SIMIX_network_exit(void)
other_action->comm.match_fun = match_fun;
- if (MC_IS_ENABLED) {
+ if (MC_is_active()) {
other_action->state = SIMIX_RUNNING;
return other_action;
}
SIMIX_comm_copy_data(other_action);*/
- if (MC_IS_ENABLED) {
+ if (MC_is_active()) {
other_action->state = SIMIX_RUNNING;
return other_action;
}
XBT_DEBUG("iprobe from %p %p\n", rdv, rdv->comm_fifo);
smx_action_t this_action = SIMIX_comm_new(SIMIX_COMM_RECEIVE);
- smx_action_t other_action;
+ smx_action_t other_action=NULL;
if(rdv->permanent_receiver && xbt_fifo_size(rdv->done_comm_fifo)!=0){
//find a match in the already received fifo
+ XBT_DEBUG("first try in the perm recv mailbox \n");
+
other_action = SIMIX_fifo_probe_comm(rdv->done_comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
- }else{
- other_action = SIMIX_fifo_probe_comm(rdv->comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
}
+ // }else{
+ if(!other_action){
+ XBT_DEBUG("second try in the other mailbox");
+ other_action = SIMIX_fifo_probe_comm(rdv->comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
+ }
+// }
if(other_action)other_action->comm.refcount--;
SIMIX_comm_destroy(this_action);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
- if (MC_IS_ENABLED) {
+ if (MC_is_active()) {
if (idx == 0) {
action->state = SIMIX_DONE;
} else {
{
smx_action_t action = simcall->comm_test.comm;
- if(MC_IS_ENABLED){
+ if(MC_is_active()){
simcall->comm_test.result = action->comm.src_proc && action->comm.dst_proc;
if(simcall->comm_test.result){
action->state = SIMIX_DONE;
xbt_dynar_t actions = simcall->comm_testany.comms;
simcall->comm_testany.result = -1;
- if (MC_IS_ENABLED){
+ if (MC_is_active()){
if(idx == -1){
SIMIX_simcall_answer(simcall);
}else{
unsigned int cursor = 0;
xbt_dynar_t actions = simcall->comm_waitany.comms;
- if (MC_IS_ENABLED){
+ if (MC_is_active()){
action = xbt_dynar_get_as(actions, idx, smx_action_t);
xbt_fifo_push(action->simcalls, simcall);
simcall->comm_waitany.result = idx;
return it as the result of the simcall */
if (simcall->call == SIMCALL_COMM_WAITANY) {
SIMIX_waitany_remove_simcall_from_actions(simcall);
- if (!MC_IS_ENABLED)
+ if (!MC_is_active())
simcall->comm_waitany.result = xbt_dynar_search(simcall->comm_waitany.comms, &action);
}
SIMIX_rdv_remove(action->comm.rdv, action);
action->state = SIMIX_CANCELED;
}
- else if (!MC_IS_ENABLED /* when running the MC there are no surf actions */
+ else if (!MC_is_active() /* when running the MC there are no surf actions */
&& (action->state == SIMIX_READY || action->state == SIMIX_RUNNING)) {
surf_workstation_model->action_cancel(action->comm.surf_comm);