Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into CRTP
[simgrid.git] / src / kernel / activity / CommImpl.cpp
index 8e95559..03c3cbf 100644 (file)
@@ -238,7 +238,7 @@ void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity:
   }
 
   simcall_comm_test__set__result(simcall, res);
-  if (simcall_comm_test__get__result(simcall)) {
+  if (res) {
     comm->simcalls_.push_back(simcall);
     comm->finish();
   } else {
@@ -564,10 +564,8 @@ void CommImpl::post()
   /* destroy the surf actions associated with the Simix communication */
   cleanupSurf();
 
-  /* if there are simcalls associated with the synchro, then answer them */
-  if (not simcalls_.empty()) {
-    finish();
-  }
+  /* Answer all simcalls associated with the synchro */
+  finish();
 }
 
 void CommImpl::finish()
@@ -581,7 +579,7 @@ void CommImpl::finish()
      * simcall */
 
     if (simcall->call_ == SIMCALL_NONE) // FIXME: maybe a better way to handle this case
-      continue;                        // if process handling comm is killed
+      continue;                         // if actor handling comm is killed
     if (simcall->call_ == SIMCALL_COMM_WAITANY) {
       SIMIX_waitany_remove_simcall_from_actions(simcall);
       if (simcall->timeout_cb_) {
@@ -670,6 +668,7 @@ void CommImpl::finish()
         default:
           xbt_die("Unexpected synchro state in CommImpl::finish: %d", static_cast<int>(state_));
       }
+      simcall->issuer_->simcall_answer();
     }
     /* if there is an exception during a waitany or a testany, indicate the position of the failed communication */
     if (simcall->issuer_->exception_ &&
@@ -681,7 +680,7 @@ void CommImpl::finish()
         comms = simcall_comm_waitany__get__comms(simcall);
         count = simcall_comm_waitany__get__count(simcall);
       } else {
-        /* simcall->call == SIMCALL_COMM_TESTANY */
+        /* simcall->call_ == SIMCALL_COMM_TESTANY */
         comms = simcall_comm_testany__get__comms(simcall);
         count = simcall_comm_testany__get__count(simcall);
       }
@@ -710,11 +709,6 @@ void CommImpl::finish()
         src_actor_->comms.remove(this);
       }
     }
-
-    if (simcall->issuer_->get_host()->is_on())
-      simcall->issuer_->simcall_answer();
-    else
-      simcall->issuer_->context_->iwannadie = true;
   }
 }