Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Some bugfixes:
authorcristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 20 Jan 2011 15:44:47 +0000 (15:44 +0000)
committercristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 20 Jan 2011 15:44:47 +0000 (15:44 +0000)
- consider timeouts on wait calls
- test calls are always enabled
- do not destroy surf actions on comm_cancel when running the MC

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9453 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/simix/smx_network.c
src/simix/smx_smurf.c

index 990a4f5..8280532 100644 (file)
@@ -326,7 +326,20 @@ void SIMIX_pre_comm_wait(smx_req_t req)
   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;
   }
@@ -611,7 +624,9 @@ void SIMIX_comm_cancel(smx_action_t action)
     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);
   }
 }
 
index a5c10c9..a80a17f 100644 (file)
@@ -90,6 +90,12 @@ int SIMIX_request_is_enabled(smx_req_t req)
 
     case REQ_COMM_WAIT:
       /* FIXME: check also that src and dst processes are not suspended */
+      /* If there is a timeout it will be always enabled because, if the
+       * communication is not ready, it can timeout.
+       * This avoids false positives on dead-locks */
+      if(req->comm_wait.timeout >= 0)
+        return TRUE;
+
       act = req->comm_wait.comm;
       return (act->comm.src_proc && act->comm.dst_proc);
       break;
@@ -103,11 +109,6 @@ int SIMIX_request_is_enabled(smx_req_t req)
       return FALSE;
       break;
 
-    case REQ_COMM_TEST:
-      act = req->comm_test.comm;
-      return (act->comm.src_proc && act->comm.dst_proc);
-      break;
-
     default:    
       return TRUE;
   }